编辑器
语法高亮
🌐 Syntax Highlighting

如今,许多流行的编辑器开箱即可支持 ES2015+ 语法高亮,而有些则需要安装额外的扩展。这个指南应该能帮你让语法高亮正常工作。
🌐 These days, many popular editors support ES2015+ syntax highlighting out of the box, while some require installing additional extensions. This guide should help you get the syntax highlighting to work.
如果你想寻找更高级的集成,你可能想看看设置指南。
🌐 If you're looking for more advanced integrations, you may want to take a look at the Setup guide.
小贴士: 上面截图使用的字体是 FiraCode。
Atom
安装 language-babel 包并按照 instructions 操作。
🌐 Install language-babel package and follow the instructions.
Emacs
安装 js2-mode,它可能是 Emacs 上最好的 JavaScript 模式。它使用递归下降解析器进行非常准确的语法高亮,严格遵循 Ecma-262 语言标准,支持大多数从 1.5 版本起的 Rhino 和 SpiderMonkey 扩展,并能够实时报告语法错误和严格模式警告。
🌐 Install the js2-mode that's likely the best JavaScript mode available for Emacs. It has very accurate syntax highlighting using a recursive-descent parser, strict recognition of the Ecma-262 language standard, supports most Rhino and SpiderMonkey extensions from 1.5 and up, and on-the-fly reporting of syntax errors and strict-mode warnings.
除了 js2-mode 外,你还可以安装另外两个包,js2-refactor 可以提供强大的重构功能,而 xref-js2 则让你更容易跳转到函数引用或定义。
🌐 In adition to js2-mode, you can install two more packages, js2-refactor that adds powerful refactorings, and xref-js2 that makes it easy to jump to function references or definitions.
Sublime Text 3
首先,安装 Package Control。 然后从 Package Control 菜单中安装 Babel 插件,并按照 说明 操作。
🌐 First, install Package Control. Then install Babel package from the Package Control menu and follow the instructions.
Vim
安装 vim-javascript 插件,它为 Vim 提供了更好的 JavaScript 语法高亮和缩进支持。
🌐 Install the vim-javascript plugin, which brings both improved syntax highlighting and indentation support for JavaScript to Vim.
另一个选择是使用 yajs.vim 和 es.next.syntax。
🌐 Another option is to use yajs.vim with es.next.syntax.
Visual Studio Code
安装 vscode-language-babel 扩展并按照说明操作。
🌐 Install the vscode-language-babel extension and follow the instructions.
似乎还有另一种方法可以让语法高亮工作,你可以在Visual Studio Code 文档中了解更多信息。
🌐 There seems to be one other way to get the syntax highlighting working and you can learn more about it in the Visual Studio Code docs.
WebStorm
WebStorm 现在自带对 ES2015+ 的支持,无需安装任何额外的扩展。不过,你可能需要启用它。
🌐 WebStorm now ships with support for ES2015+ without requiring the installation of any additional extensions. You may, however, need to enable it.
Emacs
安装 js2-mode。
🌐 Install the js2-mode.
另一种选择是使用 web-mode。
🌐 Another option is to use web-mode.