在哪里可以找到 Sublime Text 3 的 "syntax highlighter" 范围语法?
Where to find "syntax highlighter" scope syntax for Sublime Text 3?
我正在为 Sublime Text 3 编写语法荧光笔,但我面临着找到正确的语法范围的问题。
例如
constants:
- match: \b(true|false)\b
scope: constants.language.boolean
- match: \b(void|new)\b
scope: constants.language
# operators
operators:
- match: \b(and|or|not)\b
scope: keyword.operator.logical
- match: \b(\+=|-=|*=|\/=|%=|==|!=|<=|>=|<|>|\+|-|\*|\/|%|\^)\b
scope: keyword.operator.arithmetic
我怎么知道 and
、+=
、true
、false
等的范围
所有可用的作用域语法在哪里?
谁能告诉我它的 documentation/source 代码?任何帮助将不胜感激。
我找到了这个关于语法高亮的官方页面 https://www.sublimetext.com/docs/3/syntax.html,但它并没有多大帮助。
谢谢
在查看其他语言的文件时,您应该通读现有的 .sublime-syntax
文件,这些文件位于 Github 上的 sublimehq/Packages
, for the standards that are being used. I'd also suggest using the ScopeHunter
and ScopeAlways
插件中,以确定哪些范围在给定点处于活动状态。
以下是一些其他资源:
- Sublime Text unofficial docs on syntax definitions
- Unofficial docs syntax definitions reference
- TextMate Manual on naming conventions - 向下滚动到第 12.4 节
没有一成不变的 "standards",但尝试遵循 TextMate 约定是个好主意。如果您为其编写定义的语言与现有语言相似,您也可以将其用作模板。但是,每个定义都略有不同,所以如果有必要,请不要害怕组成您自己的独特选择器。
我正在为 Sublime Text 3 编写语法荧光笔,但我面临着找到正确的语法范围的问题。 例如
constants:
- match: \b(true|false)\b
scope: constants.language.boolean
- match: \b(void|new)\b
scope: constants.language
# operators
operators:
- match: \b(and|or|not)\b
scope: keyword.operator.logical
- match: \b(\+=|-=|*=|\/=|%=|==|!=|<=|>=|<|>|\+|-|\*|\/|%|\^)\b
scope: keyword.operator.arithmetic
我怎么知道 and
、+=
、true
、false
等的范围
所有可用的作用域语法在哪里?
谁能告诉我它的 documentation/source 代码?任何帮助将不胜感激。
我找到了这个关于语法高亮的官方页面 https://www.sublimetext.com/docs/3/syntax.html,但它并没有多大帮助。
谢谢
在查看其他语言的文件时,您应该通读现有的 .sublime-syntax
文件,这些文件位于 Github 上的 sublimehq/Packages
, for the standards that are being used. I'd also suggest using the ScopeHunter
and ScopeAlways
插件中,以确定哪些范围在给定点处于活动状态。
以下是一些其他资源:
- Sublime Text unofficial docs on syntax definitions
- Unofficial docs syntax definitions reference
- TextMate Manual on naming conventions - 向下滚动到第 12.4 节
没有一成不变的 "standards",但尝试遵循 TextMate 约定是个好主意。如果您为其编写定义的语言与现有语言相似,您也可以将其用作模板。但是,每个定义都略有不同,所以如果有必要,请不要害怕组成您自己的独特选择器。