Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
718 views
in Technique[技术] by (71.8m points)

visual studio code - Where can I find a list of all possible keys for tm-themes for syntax highlighting?

In the tmTheme file for my current text editor there are a number of options, including the ones in the code below. Is there a list somewhere that defines all possible tags that could be included in this list (eg. background, inactiveSelection, findHighlight, etc)?

<dict>

<key>background</key>
<string>#1a1a1a</string>

<key>caret</key>
<string>#B6ECF9AF</string>

<key>foreground</key>
<string>#ecf0f1</string>

<key>invisibles</key>
<string>#F3FFB51A</string>

<key>lineHighlight</key>
<string>#2a2a2a</string>

<key>selection</key>
<string>#e74c3c55</string>

<key>selectionForeground</key>
<string>#ffffff</string>

<key>findHighlight</key>
<string>#e74c3c</string>

<key>inactiveSelection</key>
<string>#e74c3c77</string>

<key>gutter</key>
<string>#2a2a2a</string>

<key>gutterForeground</key>
<string>#ffffff</string>

<key>guide</key>
<string>#222222</string>

<key>activeGuide</key>
<string>#ffffff</string>

</dict>

Another example with even more tags: Other Theme

If it's relevant, I'm using VSCode.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

tmLanguage scope names are based on convention, so there's no definitive list. The "Naming Conventions" section at the bottom of this TextMate Manual page is fairly comprehensive though.

You can also check what scopes are highlighted by VSCode's default themes, see for instance dark_plus.json and dark_vs.json (which the former is based on / includes).

Finally, as of VSCode 1.9.0, there is a builtin command to inspect tmLanguage scopes (Developer: Inspect Editor Tokens and Scopes). It will give you a lot of information over how the token at the cursor location is scoped / highlighted:

There is also a Scope Info extension which does a very similar thing, but on hover (which I personally prefer usability-wise). However, it only lists the scope names, not including any of the additional info that VSCode's built-in inspector has.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...