I have read other posts talking about the Aptana plugin with Eclipse PDT and I've installed it and still have no syntax highlighting of javascript within my php files.
I have a php file with my php at the top if the form has been submitted and then the rest of the content is javascript/html, outside the php tags obviously. The html has syntax highlighting but I still have no syntax highlighting for the javascript. I've added the Aptana JS editor to the *.php file types in the settings and still nothing.
I have a feeling that it's defaulting to the PHPEclipse editor, which I guess doesn't support javascript syntax highlighting? Any ideas or am I forced to make all of my javascript files external to the php file?
A PHP file like that will be a combination of four different editors: PHP, HTML, CSS, and JavaScript
PDT uses the Web Tools Projects (WTP/WST) for HTML, JS and CSS support. It's impossible to use the Aptana HTML, CSS, or JS editors inside a file opened with the PDT PHP editor, so the level of support you get in PDT is completely dependent on the WTP editors. Your only solution there would be to externalize your JavaScript into a separate file, which you could open with the Aptana JavaScript editor.
Aptana Studio 2 used the PDT for PHP editing. Aptana Studio 3 bundles its own PHP editor, so you will get the combination of a PHP editor for the PHP-parts + Aptana support for HTML, CSS and JavaScript.
You are probably not going to be able to "activate" better JavaScript support in the PHP editor since it simply a lack of support issue.
Actually, you just need to open the file in the "PHP Source Editor" instead of the "PHP Editor". The former is from Aptana and provides the improved support for JS, plus allows you to use added jQuery bundles, while the standard (PDT-supplied) "PHP Editor" does have some features lacking in the Aptana version, but is generally trumped by Aptana. We'll see where they go in the future, but Aptana has brought some nice features to the table.
Related
Bottom Line Up Front: Eclipse Neon content assist (Ctrl+space) does not offer any proposals for my JavaScript code.
Here is what I've checked so far:
JSDT has been installed
"JavaScript resources" include ECMASciptBuilt-In Library, ECMA 3 Browser Support Library, jQuery
The project's Include path has ECMAScipt Built-In Library, ECMA 3 Browser Support Library, jQuery, and JavaScript Web Project support
Eclipse's JavaScript Content Assist is enabled and includes Basic proposals, Other JavaScript Proposals, Template Proposals, and word proposals.
I changed the content assist from ctrl+space to ctrl+0 to check whether ctrl+space had been hijacked
Content assist DOES work with regular Java (in a different project)
I tried reset to defaults under Content Assist > Advanced
JavaScript facet is selected for the project
.js files and .jsp files are stored in folders that are under folders that are designated as source folders in the project properties under JavaScript > Include Path
This is also an issue in Mars 2.
I've run through the steps listed here for configuring content assist: http://www.eclipse.org/pdt/help/html/using_javascript_content_assist.htm
The content assist isn't even proposing functions that are defined within the same .js file. How can I get Eclipse's content assist to propose elements correctly?
I have the same problem and it seems to be a known bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=504057
+1 not working in Eclipse Neon. As an alternative you may try Netbeans 8. Javascript is working good there. I don't know what happened to Eclipse but php and Js support is poor.
P.S. Just downloaded Eclipse Mars - can confirm that it's working fine.
I've met this situation before,and then I found that if the js file is in a "normal java project",then it won't come uip with content assist,but if the js file is in a "dynamic web project",then the content assist just work well,hope it will help.
I'm using IntelliJ IDEA 12 Community Edition, and am trying to set the syntax coloring for Javascript files. When I choose File > Settings > IDE Settings > Editor > Colors & Fonts, Javascript is not an option in the list. Is this a limitation of the Community Edition IDE, or am I missing something? The others I need are listed, like Java and HTML, but Javascript is missing from the list.
Thanks.
JavaScript support is supported in Ultimate Edition, but not in Community Edition.
For the basic syntax highlighting you can try the TextMate Bundles Support plug-in. See this document for the setup instructions (it's for PhpStorm, but instructions for IntelliJ IDEA would be the same).
The TextMate Bundles Support plug-in is not enough. You also need specific language bundles.
install and enabled the TextMate bundle support plugin in IntelliJ
Download the specific language bundles and unzip them somewhere where you find them, e.g., TypeScript, Shell Script TextMate Bundle
Open the Settings/Preferences dialog, got to Editor and select TextMate Bundles
Click on the + on the right side and choose the desired bundle from 2. on your hard disk. Then it should appear in the list of recognized bundles.
Extension conflicts might appear: Click on "Show details". If you want to use the new syntax highlighting click on "unregister native file type".
A detailed explanation with screenshots can be found here
I found this question after searching by "how to enable JS syntax highlight into JSP files" in my Intellij Community Edition.
Following the suggestion to use TextMate Bundles, I checked that it's already installed by default, including JSP support (built-in). But it did not work.
So, I fixed it by just removing the "*.jsp" pattern from "File Types > JSP", and after that now my IDE is using TextMate syntax highlight properly.
Use Visual Studio Code for Javascript support when using IntelliJ Community Edition. It's free and has all the support you would get for the paid version of IntelliJ Ultimate.
Or buy it for $149 (personal ultimate edition). I've been buying it since 2013 and find it far superior to XCode. This is just my personal opinion though. Download a trial and see how you like it!
Pricing:
https://www.jetbrains.com/idea/buy/#personal?billing=yearly
Trial:
https://www.jetbrains.com/idea/download/
ps: I'm not endorsed or affiliated with Jetbrains. Just a fan.
Alternative I tried (but raised another issue):
Marked VS Code as default app to open .js files.
For IntelliJ, follow this: to configure .js files should be opened using VS Code
This has enabled to opening .js files into VS code when we command from IntelliJ Idea, but strangely, .js got disappeared from "Find in files" search list.
Inputs are welcomed, whether I had configured it wrong.
I had netbeans 6.9, and i was trying to edit javascript on it. However, I keep getting code errors in my .js files. I can't even create a new javascript template. I tried upgrading to netbeans 7.01, but this doesn't change. I also enabled the JAVA plugin, but it doesn't help.
Anyone know what's going on?
I get a bunch of errors where it says "unclosed character literal" or
"character, interface, or enum expected"
I suspect you've somehow configured NetBeans to handle *.js files as Java, which is an entirely different language.
Go to Tools-> Options-> Miscellaneous-> Files and find js in the "File Extension" combo. The "Associated File Type (MIME)" input box should say text/javascript.
the java-plugin is for java, so this won't help you.
what you'll need is to activate javascript-support. javascript is included in the PHP-pack (and also available as plugin).
to install the plugin, simply click tools -> plugins and install PHP to enable javascript-(and html-)support.
Eclipse provides 2 Plugins to Work with XML and javascript, namely "Eclipse XML Editors and Tools" and "Javascript Development Tools".
If I open a *.js file, I get javascript support, if I open a *.xml file, I get XML support. Those tools work.
If I open a *.xhtml file, I get those combined (XML support for the xhtml tags and javascript support for the included javascript tags).
Now I have another XML file format, which is NOT xhtml, but also contains embedded javascript code.
For example:
<xui>
<name>Test</name>
<script type="text/javascript"><![CDATA[
alert( 1 );
]]></script>
</xui>
Is there any way to get XML support and javascript support to work within the same file?
I don't think so. The reason its working this way is because there was an editor written explicitly for the file you're opening. There isn't really a way to say "combine the functionality of these two editors". Also, even if you did find such a thing, you have you're script wrapped in a CDATA element, which tells any xml parsers to ignore it, and so if you're editor is looking for xml it will ignore the script.
If I were you, I would try and remove the cdata, and open it in the html editor. Since it is possible to embed javascript in html, the eclipse editor might account for that and provide some useful syntax highlighting (even though I don't know this for sure, its worth a shot). If not, you could also give notepad++ a shot if you're on a windows box (or VI on anything else). There also might be some Aptana plugins that you might find useful; even though I can't name any off of the top of my head.
Which plugins do you use for editing (with syntax highlighting) HTML & Javascript in Eclipse 3.5?
Spket is a great plugin for JavaScript. For HTML, I normally just use the default XML/HTML editor that comes with Eclipse WTP which is good enough for my purposes. Depending on which Eclipse distro you downloaded, you may already have this
I've heard Aptana is great, but I have not used it personally.
Eclipse WTP