So I've added:
所以我补充说:
<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>
to my color scheme called custom.tmTheme
and I've added:
我的配色名为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>
to a JSON-test.tmLanguage
file in my packages folder, but yet I still don't see green keys.
到我的packages文件夹中的JSON-test.tmLanguage文件,但我仍然看不到绿键。
Does anyone have any idea where I went wrong?
有谁知道我哪里出错了?
1 个解决方案
#1
5
You don't need to create or modify a .tmLanguage
file, you should be able to do this simply using the JavaScript -> JSON
syntax. Modify your .tmTheme
like so:
您不需要创建或修改.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>
and you should be all set. It will highlight all strings contained within JSON dictionaries, but not if the scope contains meta.structure.dictionary.value.json
, so it will only highlight the keys.
你应该全力以赴。它将突出显示JSON字典中包含的所有字符串,但如果范围包含meta.structure.dictionary.value.json则不会,因此它只会突出显示键。
#1
5
You don't need to create or modify a .tmLanguage
file, you should be able to do this simply using the JavaScript -> JSON
syntax. Modify your .tmTheme
like so:
您不需要创建或修改.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>
and you should be all set. It will highlight all strings contained within JSON dictionaries, but not if the scope contains meta.structure.dictionary.value.json
, so it will only highlight the keys.
你应该全力以赴。它将突出显示JSON字典中包含的所有字符串,但如果范围包含meta.structure.dictionary.value.json则不会,因此它只会突出显示键。