Javascript hightlighting within *.php files in Eclipse
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 p开发者_运维百科hp 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.
精彩评论