所以我添加了:
<dict>
<key>name</key>
<string>JSON Key</string>
<key>scope</key>
<string>meta.structure.dictionary.json string2.quoted.double.json</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#00FF00</string>
</dict>
</dict>在我的名为custom.tmTheme的配色方案中,我添加了:
<key>string2</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string2.begin.json</string>
</dict>
</dict>
<key>end</key>
<string>"\s.:</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string2.end.json</string>
</dict>
</dict>
<key>name</key>
<string>string2.quoted.double.json</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?x: # turn on extended mode
\\ # a literal backslash
(?: # ...followed by...
["\\/bfnrt] # one of these characters
| # ...or...
u # a u
[0-9a-fA-F]{4} # and four hex digits
)
)</string>
<key>name</key>
<string>constant.character.escape.json</string>
</dict>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>invalid.illegal.unrecognized-string-escape.json</string>
</dict>
</array>
</dict>添加到我的packages文件夹中的一个JSON-test.tmLanguage文件中,但是我仍然没有看到绿色的密钥。
有人知道我哪里出错了吗?
发布于 2014-05-02 05:28:34
您不需要创建或修改.tmLanguage文件,只需使用JavaScript -> JSON语法即可。像这样修改你的.tmTheme:
<dict>
<key>name</key>
<string>JSON Key</string>
<key>scope</key>
<string>meta.structure.dictionary.json string.quoted.double.json -meta.structure.dictionary.value.json</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#00FF00</string>
</dict>
</dict>你应该都准备好了。它将高亮显示JSON字典中包含的所有字符串,但如果作用域包含meta.structure.dictionary.value.json,则不会高亮显示,因此它只会高亮显示键。
https://stackoverflow.com/questions/23416098
复制相似问题