Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript syntax highlighting in Eclipse not working?

I would like syntax highlighting for some Javascript code that I am working with, so I installed "Web Developer Tools" and "Javascript Developer Tools" through Eclipse. I checked the preferences to make sure the syntax highlighting was enabled but it doesn't seem to be working.

I did some searching and it seems that for projects that are not created as Javascript projects, the syntax highlighting doesn't work.

Actually, I am not sure how to implement the solution on that webpage, I'm not really sure what "vim" is. (I don't think it's the text editor)

Is there an alternate way to get this syntax highlighting working?

like image 581
Fam Avatar asked Mar 14 '13 16:03

Fam


People also ask

Why JavaScript is not working in Eclipse?

It's possible that you are developing in a different perspective that does not have this association preset. It should be noted, if it was already opened in normal eclipse editor, you need to close and reopen file for that to take effect. (The JS editor as default should be set automatically.)

Can Eclipse support JavaScript?

Eclipse has usable JavaScript support if you are willing to overlook the incorrect code diagnostics, lack of code folding, and slow IDE startup.


2 Answers

Check your "File Associations" setting to ensure that *.js files are associated with the JavaScript Editor by default.

  • Window > Preferences
  • General > Editors > File Associations
  • Under "File types" select "*.js"
  • If not present, under "Associated editors" click on "Add..." and choose Internal > JavaScript Editor
  • Under "Associated editors" click on "JavaScript Editor" and select the "Default" button

If you are developing in the JavaScript perspective, this should already be set. It's possible that you are developing in a different perspective that does not have this association preset.

like image 193
Rick Viscomi Avatar answered Oct 24 '22 06:10

Rick Viscomi


File association is definitely a place to check. In the 2021-03 build, the Generic Text Editor actually has js highlighting. The previous default for me was Text Editor. When I switched to Generic Text Editor, it worksenter image description here

like image 43
tuotuoZ Avatar answered Oct 24 '22 05:10

tuotuoZ