Sublime Forum

Selective Non-Italics

#1

I have all comments set to fontStyle italics in my tmTheme.

I’ve added rules to the js grammar to highlight annotations. Currently, these are italicized because they are in a comment. I would prefer if they were not. Is this possible yet?

These are the two tmTheme rules. I have tried multiple variants for fontStyle including regular, Regular, and an empty string, I restarted sublime and removed the cache files each time too. What am I doing wrong?

The relevant scope is something like: source.js comment keyword.documentation.annotation

      <dict>
        <key>name</key>
        <string>Comment</string>
        <key>scope</key>
        <string>comment</string>
        <key>settings</key>
        <dict>
          <key>fontStyle</key>
          <string>italic</string>
          <key>foreground</key>
          <string>#8A8A8A</string>
        </dict>
      </dict>
      <dict>
        <key>name</key>
        <string>annotation</string>
        <key>scope</key>
        <string>keyword.documentation.annotation</string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#FB9933</string>
          <key>fontStyle</key>
          <string>regular</string>
        </dict>
      </dict>
0 Likes

#2

Currently, italic / bold is only ever added by rules, and not removed.

You can work around this by splitting the comment scope into two parts: one which sets the color, and another that sets the font style. Change the scope in the one that sets the font style to ‘comment - keyword.documentation.annotation’

0 Likes

#3

oooo, I forgot I could use minus in tmThemes. Thanks much.

0 Likes