Javascript syntax highlighting in Eclipse not working?
Solution 1
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.
Solution 2
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 works
Solution 3
"Web Developer Tools" doesn't work in fact: It looks like a bug since there's no syntax highlight in javascript file whatever modification in "Preferences" I've tried).
(And "Javascript Developer Tools" doesn't exist anymore)
You need to install "Wild Web Developer" ("Help" > "Install new software" and search for "Wild Web Developer").
After installed, restart and it will work out of the box (no need to fiddle inside 'Preferences')
Fam
I'm a geek with a penchant for programming. I love simple, elegant solutions. I think code can be both functional and beautiful. I pride myself in my eye for design, but I'm always learning something new.
Updated on August 05, 2022Comments
-
Fam almost 2 years
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?
-
NoBugs over 10 yearsIt 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.)
-
thdoan over 3 yearsThis doesn't appear to work in Eclipse 2020-09 out of the box.
-
Durga Swaroop about 3 yearsI don't see a "Javascript editor" in editors.
-
Anders Lindén about 3 yearsSeems to be "JS Editor", trying to associate *.js with that by selecting both the file extension that "JS Editor" and press apply. No success. Restarting eclipse without getting syntax highlighting.