Javascript syntax highlighting in Eclipse not work

2019-01-26 15:18发布

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?

2条回答
等我变得足够好
2楼-- · 2019-01-26 15:25

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.

查看更多
可以哭但决不认输i
3楼-- · 2019-01-26 15:50

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.

查看更多
登录 后发表回答