Eclipse 中的 Javascript 语法高亮显示不起作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15415469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Javascript syntax highlighting in Eclipse not working?
提问by Fam
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.
我想为我正在使用的某些 Javascript 代码突出显示语法,因此我通过 Eclipse 安装了“Web 开发人员工具”和“Javascript 开发人员工具”。我检查了首选项以确保启用了语法突出显示,但它似乎不起作用。
I did some searching and it seems that for projects that are not created as Javascript projects, the syntax highlighting doesn't work.
我做了一些搜索,似乎对于不是作为 Javascript 项目创建的项目,语法突出显示不起作用。
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)
实际上,我不确定如何在该网页上实施解决方案,我不确定“vim”是什么。(我不认为这是文本编辑器)
Is there an alternate way to get this syntax highlighting working?
有没有其他方法可以让这种语法突出显示工作?
回答by Rick Viscomi
Check your "File Associations" setting to ensure that *.js files are associated with the JavaScript Editor by default.
检查您的“文件关联”设置以确保 *.js 文件默认与 JavaScript 编辑器相关联。
- 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
- 窗口 > 首选项
- 常规 > 编辑器 > 文件关联
- 在“文件类型”下选择“*.js”
- 如果不存在,在“Associated editors”下点击“Add...”并选择Internal > JavaScript Editor
- 在“Associated editors”下点击“JavaScript Editor”并选择“Default”按钮
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.
如果您是从 JavaScript 的角度进行开发,则应该已经设置了此项。您可能正在以没有此关联预设的不同视角进行开发。
回答by Noam Manos
In the new Eclipse Oxygenbuild, the word recurrences highlighter works natively, no need for special plugin. It works in XML/HTML/JSEditors - just double click on a word, and see (*almost) all recurrences highlighted:
在新的Eclipse Oxygen版本中,重复荧光笔这个词本身就可以工作,不需要特殊的插件。它适用于XML/HTML/JS编辑器 - 只需双击一个单词,即可查看(*几乎)所有突出显示的重复项:
* It ignores words inside comments tag.
* 它忽略注释标签内的单词。