IntelliJ社区版:Javascript语法高亮

Meg*_*att 18 javascript jquery syntax-highlighting intellij-idea

我正在使用IntelliJ IDEA 12社区版,我正在尝试为Javascript文件设置语法着色.当我选择文件>设置> IDE设置>编辑器>颜色和字体时,Javascript不是列表中的选项.这是Community Edition IDE的限制,还是我遗漏了什么?列出了我需要的其他内容,如Java和HTML,但列表中缺少Javascript.

谢谢.

Cra*_*der 19

Ultimate Edition支持 JavaScript支持,但Community Edition不支持.

对于基本语法突出显示,您可以尝试使用TextMate Bundles Support插件.请参阅此文档以获取设置说明(适用于PhpStorm,但IntelliJ IDEA的说明相同).


Ily*_*nov 7

2023答案

TextMate Bundles插件内置于现代 ItelliJ IDEA 版本中,并且内置了 JavaScript 包,但要使其正常工作,您必须JavaScript (syntax highlighting only)从中删除Recognized File Types

  • Settings > Editor > File Types > JavaScript (syntax highlighting only)
  • *.js从......中去除File name patterns

设置 > 编辑器 > 文件类型 > JavaScript(仅语法突出显示)

前: IntelliJ 社区版中的默认 JavaScript 突出显示

后: IntelliJ 社区版中的 TextMate JavaScript 高亮显示


Jud*_*ith 5

TextMate Bundles支持插件不够。您还需要特定的语言包。

  1. 在IntelliJ中安装并启用TextMate捆绑包支持插件
  2. 下载特定的语言包,并将其解压缩到找到它们的位置,例如TypeScriptShell Script TextMate Bundle
  3. Open the Settings/Preferences dialog, got to Editor and select TextMate Bundles
  4. Click on the + on the right side and choose the desired bundle from 2. on your hard disk. Then it should appear in the list of recognized bundles.
  5. Extension conflicts might appear: Click on "Show details". If you want to use the new syntax highlighting click on "unregister native file type".

A detailed explanation with screenshots can be found here