Does any ide give list of js functions inside php? - javascript

I use Eclipse to edit php files. It gives me the list of php variables and functions in the otline window.
Is there any IDE (free of charge) that would provide list of javascripts that are inside my php file?
I have lots of them and it would be much easier to navigata with such a list.

Netbeans for php and Aptana studio should do it and they have also an integrated javascript debugger.
I'm also sure PhpEd does NOT have this function because i use it and it's a feature i want.

Intellij idea does this. it can recognize languages within languages with a bit of config. Ive only ever used it for javascript within jsp and html, but i see they have a php app
Dont be put off by "Most advanced Java IDE" in the title. Its a great java ide, but it supports many other languages via plugins. Currently im using it to code in python for example.

Related

Java/Python Cross-Compiling in JavaScript

I am working on a project that involves having a Java code editor and a Python code editor but I have no way of compiling that code. I've used Ace within my html and I have no idea how to compile the Java code or Python code using JavaScript. I currently have a way of retrieving all of the Java/Python code to a string. From there I need a way of compiling that code so that I can run it on my website and test it. There will be no GUIs involved, all of the Java/Python code will just have console output. However, I need a way I can run the Java/Python code on my website in live speed. Everything must be done on the website, the client shouldn't have to download anything extra. I am basically trying to replicate the website 'codingbat.com'. Thanks for the help in advance.
Python would usually get JITted when you invoke a good Python interpreter (ha, the name does not apply). Java has some great compilers (standard javac or the Eclipse JDT) so I would not even think of compiling with some other language.
Where does the need come from to cross-compile in JavaScript? It sounds like you are searching for a Java compiler implemented in JavaScript, and likewise for Python.
If everything has to be built and deployed to some website, why don't you create a script (shell, JavaScript, or a Jenkins Pipeline) that compiles the java part using javac, precompiles the python part as required and deploys the output directly to your website?

Break up JavaScript file into more manageable, or using different IDE

I use Dreamweaver for development, mostly PHP, html, css, javascript. Is there anyway to break up JavaScript files? or maybe a better IDE that makes it easier to work with? It just becomes quickly difficult to read and find what I'm looking for.
Thank you!
Intellij and/or Webstorm by Jetbrains has the best JS tools I have found. It has very good (as good as it gets, for JS) intellisense (autocomplete for variables and methods) as well as refactoring for variables and methods. You can cmd+click into method definitions from anywhere, as well. Unfortunately you need to pay for them, but if you are using Dreamweaver you had to pay for that. If you are only doing html/css/javascript Webstorm is the way to go.
Yes, you should break up your javascript files into relevant parts just like you break up your php files into relevant parts. The one key factor here is they should be combined and minified before being served up to the browser so the user does not have to make several network calls to your server for each .js file.
Check out Google Minify for an easy solution to that issue.
Take a look at the JQuery source to see how they divvy up their files. Now look at their combined framework, and of course their minified framework. What is actually served up to the user looks nothing like the source.
Uh, Dreamweaver?
Definitely use a different IDE. Aptana won the poll here :)

How to use coffeescript in developing web-sites?

How do you use CoffeeScript? It need to be compiled, so - you write code in CoffeScript, compile it, and insert real JavaScript on your site?
Doesn't it take a lot of time? Or is there some another way?
P.S. I've seen another way - to insert in development stage coffeescript in text/coffeescript script-tags with coffeescript.js library (about 150k), and compile only for production version and insert real Javascript.
The answer is yes, you compile it and include the generated JavaScript on your side.
If you're using a web framework (rails, django etc) you should take a look at the following list of coffeescript plugins: https://github.com/jashkenas/coffee-script/wiki/Web-framework-plugins. They will compile your coffeescript to javascript when you deploy your app to a server.
Using the coffee-script plugin with the text/coffeescript tags is another option, gzipped and compressed, its only about 39kB, but that can add up if you include it on pages that get many hits and I don't think is a good idea when you can compile the coffeescript to javascript yourself without needing the plugin.
There is the middleman plugin which will lets you work with CoffeeScript during development, then compile and minify it for deployment.
When you are first learning coffeescript, you will almost certainly want to do your compilation manually during development, because you will probably find, as most of us do, that you need to be able to look at the javascript code in order to debug and find out what's going on. The more fluent and comfortable you become with coffescript, the less often you will need to refer to the javascript code.
I think this will probably be true no matter what your level of expertise in javascript. If you are a javascript pro, you will be dependent on looking at stuff you are familiar with, until you start to figure out how coffeescript works. On the other hand, if you are completely or partially unfamiliar with all the quirks and subtleties of javascript, such as prototypes, the javascript approach to scope and globals, and all the rest, you'll find yourself digging into javascript references, and cross-referencing the javascript code with your coffescript code, until you get familiar with it.

How can I add autocomplete in notepad++ for javascript in an .html file?

Notepad++ does auto-complete for html and also for JavaScript. but the auto-completion depends on file extension.html file supports completion for html only. Is there a way to enable auto-completion for javascript in the script tag of an html file? I mean, other than copying the auto-completion keyword list from "javascript.xml" to "html.xml" files...
You would either need to
write your own lexer plugin (may possibly have an issue of conflicting with the internal HTML lexer), or
modify the source and compile your own notepad++/Scilexer.dll
Both are not quick undertakings.
I was faced with the same dilemma. For me, The most simple way to get the functionality you desire was to switch to an editor that already does this by default called Brackets. It is specifically designed for web development and is completely free and lightweight.
Another way to do is to create 2 files and code
JavaScript in the second one (but never save it)
HTML in the first one (and copy/paste your Javascript between <script> </script> balises)
Best way to work (for security) is to use 2 separated files : your JavaScript could be protected when the user try show source-code in his browser.
by the way, Notepad++ is a very fast and smart editor, you could just add complements to it like JSLint, emmet, nppFTP, indent by fold... and change it theme by a dark one (Obsidian) : it would be enough for small projects coding. ;)

Compiling Javascript with Netbeans

I have experience using Netbeans with Java but am new to using it with Javascript. I know how to open javascript files within a Java Project but is there a way to open javascript in a "javascript project" where I might be able to "compile" the code and see possible errors. Is this possible or am I asking too much?
By compile, I'm assuming you mean simple validation (like using undefined variables or typos etc.)
I may be wrong, but netbeans has the worst javascript support. If you want simple validation of Javascript code, you may look at Eclipse javascript environment (or the Aptana plugin). IntelliJ IDEA has very decent validator as well.
To check for code quality you can use some JavaScript analysis tools like JSLint.
http://www.jslint.com/
But it's not nearly as good as compilation in a fully typed language like Java.
An alternative is to not write the JavaScript at all but use Java instead and have it converted to JavaScript. This gives you the advantage of writing fully typed code that can be statically analyzed and checked for errors. Google's GWT does this and there are other similar options.
http://www.artima.com/lejava/articles/java_to_javascript.html

Categories