Fam
Fam

Reputation: 718

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?

Upvotes: 17

Views: 34491

Answers (4)

ThePhi
ThePhi

Reputation: 2641

"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')

Upvotes: 2

tuotuoZ
tuotuoZ

Reputation: 69

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

Upvotes: 5

Noam Manos
Noam Manos

Reputation: 17040

In the new Eclipse Oxygen build, the word recurrences highlighter works natively, no need for special plugin. It works in XML/HTML/JS Editors - just double click on a word, and see (*almost) all recurrences highlighted:

enter image description here

* It ignores words inside comments tag.

Upvotes: 0

Rick Viscomi
Rick Viscomi

Reputation: 8892

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.

Upvotes: 9

Related Questions