Eclipse 的 JavaScript 编辑器插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12269560/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 07:34:25  来源:igfitidea点击:

JavaScript Editor Plugin for Eclipse

javascripteclipseeclipse-plugin

提问by TechnoCrat

Is there an Eclipse plugin available for JavaScript that allows for syntax checking and autosuggestions for .js files in Eclipse?

是否有可用于 JavaScript 的 Eclipse 插件,允许对 Eclipse 中的 .js 文件进行语法检查和自动建议?

回答by mask

Complete the following steps in Eclipse to get plugins for JavaScript files:

在 Eclipse 中完成以下步骤以获取 JavaScript 文件的插件:

  1. Open Eclipse -> Go to "Help" -> "Install New Software"
  2. Select the repository for your version of Eclipse. I have Juno so I selected http://download.eclipse.org/releases/juno
  3. Expand "Programming Languages" -> Check the box next to "JavaScript Development Tools"
  4. Click "Next" -> "Next" -> Accept the Terms of the License Agreement -> "Finish"
  5. Wait for the software to install, then restart Eclipse (by clicking "Yes" button at pop up window)
  6. Once Eclipse has restarted, open "Window" -> "Preferences" -> Expand "General" and "Editors" -> Click "File Associations" -> Add ".js" to the "File types:" list, if it is not already there
  7. In the same "File Associations" dialog, click "Add" in the "Associated editors:" section
  8. Select "Internal editors" radio at the top
  9. Select "JavaScript Viewer". Click "OK" -> "OK"
  1. 打开 Eclipse -> 转到“帮助”->“安装新软件”
  2. 为您的 Eclipse 版本选择存储库。我有朱诺 所以我选择了http://download.eclipse.org/releases/juno
  3. 展开“编程语言”-> 选中“JavaScript 开发工具”旁边的框
  4. 点击“下一步”->“下一步”->接受许可协议条款->“完成”
  5. 等待软件安装,然后重新启动 Eclipse(通过在弹出窗口中单击“是”按钮)
  6. Eclipse 重新启动后,打开“窗口”->“首选项”-> 展开“常规”和“编辑器”-> 单击“文件关联”-> 将“.js”添加到“文件类型:”列表(如果是)还没有
  7. 在同一个“文件关联”对话框中,单击“关联编辑器:”部分中的“添加”
  8. 选择顶部的“内部编辑”收音机
  9. 选择“JavaScript 查看器”。单击“确定”->“确定”

To add JavaScript Perspective: (Optional)
10. Go to "Window" -> "Open Perspective" -> "Other..."
11. Select "JavaScript". Click "OK"

添加 JavaScript 透视图:(可选)
10. 转到“窗口”->“打开透视图”->“其他...”
11. 选择“JavaScript”。点击“确定”

To open .html or .js file with highlighted JavaScript syntax:
12. (Optional) Select JavaScript Perspective
13. Browse and Select .html or .js file in Script Explorer in [JavaScript Perspective] (Or Package Explorer [Java Perspective] Or PyDev Package Explorer [PyDev Perspective] Don't matter.)
14. Right-click on .html or .js file -> "Open With" -> "Other..."
15. Select "Internal editors"
16. Select "Java Script Editor". Click "OK" (see JavaScript syntax is now highlighted )

要使用突出显示的 JavaScript 语法打开 .html 或 .js 文件:
12.(可选)选择 JavaScript Perspective
13. 在 [JavaScript Perspective] 的 Script Explorer 中浏览并选择 .html 或 .js 文件(或 Package Explorer [Java Perspective] 或 PyDev Package Explorer [PyDev Perspective] 无所谓。)
14. 右键单击​​ .html 或 .js 文件 -> “打开方式” -> “其他...”
15. 选择“内部编辑器”
16. 选择“Java脚本编辑器”。单击“确定”(请参阅​​ JavaScript 语法现在突出显示)

回答by Ben Green

Think that JavaScriptDevelopmentTools might do it. Although, I have eclipse indigo, and I'm pretty sure it does that kind of thing automatically.

认为 JavaScriptDevelopmentTools 可能会做到。虽然,我有 eclipse indigo,而且我很确定它会自动做那种事情。

回答by Paul Verest

JavaScript that allows for syntax checking

允许进行语法检查的 JavaScript

JSHint-Eclipse

JSHint-Eclipse

and autosuggestions for .js files in Eclipse?

和 Eclipse 中 .js 文件的自动建议?

  1. Use JSDoc moreas JSDT has nice support for the standard, so you will get more suggestions for your own code.
  2. There is new TernIDE that provide additional hints for .js and AngulatJS .html. Get them together as Anide from http://www.nodeclipse.org/updates/anide/
  1. 多使用 JSDoc,因为 JSDT 对标准有很好的支持,所以你会得到更多关于你自己代码的建议。
  2. 新的 TernIDE 为 .js 和 AngulatJS .html 提供了额外的提示。将他们作为 Anide 从http://www.nodeclipse.org/updates/anide/

As Nodeclipselead, I am always looking for what is available in Eclipse ecosystem. Nodeclipsesite has even more links, and I am inviting to collaborate on the JavaScript tools on GitHub

作为Nodeclipse 的负责人,我一直在寻找 Eclipse 生态系统中可用的东西。Nodeclipse站点有更多链接,我邀请在 GitHub 上就 JavaScript 工具进行协作

回答by Christophe Roussy

In 2015 I would go with:

2015 年,我会选择:

  • For small scripts: The js editor + jsHint plugin
  • For large code bases: TypeScript Eclipse plugin, or a similar transpiled language... I only know that TypeScript works well in Eclipse.
  • 对于小脚本:js 编辑器 + jsHint 插件
  • 对于大型代码库:TypeScript Eclipse plugin或类似的转译语言...我只知道 TypeScript 在 Eclipse 中运行良好。

Of course you may want to keep JS for easy project setup and to avoid the transpilation process... there is no ultimate solution.

当然,您可能希望保留 JS 以方便项目设置并避免转译过程……没有最终的解决方案。

Or just wait for ECMA6, 7, ... :)

或者只是等待 ECMA6, 7, ... :)