【发布时间】:2019-05-28 10:42:42
【问题描述】:
我在 MacOS X 10.13 High Sierra 上使用 Atom 1.33.0
要配置 atom 以将扩展名为“.ini”的文件识别为 Java 属性并应用适当的语法高亮,我检查了以下链接:
- GitHub Atom: How to apply a particular syntax highlighting to some files based on name
- https://discuss.atom.io/t/how-do-i-make-atom-recognize-a-file-with-extension-x-as-language-y/26539
- https://flight-manual.atom.io/using-atom/sections/basic-customization/#finding-a-languages-scope-name
- https://stackoverflow.com/a/51321435/6204861
- https://discuss.atom.io/t/using-customfiletypes-to-change-the-language-for-html/40230
并假设以下 config.cson 可以工作:
"*":
core:
telemetryConsent: "no"
themes: [
"atom-light-ui"
"atom-light-syntax"
]
customFileTypes:
'source.Java Properties': [
'ini'
]
...
很遗憾,这并没有达到预期的效果。
为了找到正确的名称,我打开了一个示例 Java 属性“.ini”文件作为“纯文本”。然后我通过单击右下角将语法突出显示手动更改为“Java 属性”。然后我按下 Alt-CMD-P 显示:
所以“source.java-properties”应该是正确的名称。 我相应地修改了 config.cson:
"*":
core:
telemetryConsent: "no"
themes: [
"atom-light-ui"
"atom-light-syntax"
]
customFileTypes:
'source.java-properties': [
'ini'
]
还是不行。
需要进行哪些更改才能使其正常工作?
【问题讨论】:
标签: syntax-highlighting atom-editor