Problem
When using a bundled theme, Rider or CLion Nova correctly highlights code in inactive code branches, for e.g.: Theme: Islands Dark; Colorscheme: Rider Islands Dark:
However, once installing a custom theme from the marketplace, this highlighting stops working, and only a limited number of keywords are highlighted, for e.g.:
Explanation
The inactive code branch highlighting is implemented in Rider that way that the theme itself should specify how to render the inactive code. If a theme doesn't specify it, the result is as shown above.
Solution
As a user of a theme with such an issue
-
Open Settings | Editor | Color Scheme;
-
Export the necessary colorscheme as a .icls:
-
Open the .icls for edit and add the following option as a child element under <attributes>: (! option is different for CLion, see below)
<option name="ReSharper.C_PREPROCESSOR_INACTIVE_BRANCH_V2"> <value> <option name="EFFECT_COLOR" value="FF00FF" /> <option name="EFFECT_TYPE" value="6" /> </value> </option> -
So that the resulting file looks like:
<scheme name="ThemeName" version="142" parent_scheme="Darcula"> <metaInfo>...</metaInfo> <colors>...</colors> <attributes> ... <option name="ReSharper.C_PREPROCESSOR_INACTIVE_BRANCH_V2"> <value> <option name="EFFECT_COLOR" value="FF00FF" /> <option name="EFFECT_TYPE" value="6" /> </value> </option> ... </attributes> </scheme> -
Save the changes and import the updated colorscheme from Rider (Settings | Editor | Color Scheme | Cog | Import Scheme):
-
Once it is done, the highlighting in inactive code branches should start working for that particular color scheme;
As a theme developer
When one bundles a colorscheme together with a theme, one has ThemeName.json and ThemeName.xml . For the inactive code highlighting to work with a colorscheme, it is necessary to specify it in the .xml file of a colorscheme, for e.g: (! option is different for CLion, see below):
<scheme name="ThemeName" version="142" parent_scheme="Darcula">
<metaInfo>...</metaInfo>
<colors>...</colors>
<attributes>
...
<option name="ReSharper.C_PREPROCESSOR_INACTIVE_BRANCH_V2">
<value>
<option name="EFFECT_COLOR" value="FF00FF" />
<option name="EFFECT_TYPE" value="6" />
</value>
</option>
...
</attributes>
</scheme>
Additional notes:
-
The option for CLion is:
<option name="OC.CONDITIONALLY_NOT_COMPILED_V2"> <value> <option name="EFFECT_TYPE" value="6"/> <option name="EFFECT_COLOR" value="616161"/> </value> </option> -
EFFECT_TYPE=6 is a transparent effect. The value of EFFECT_COLOR is in fact ignored by IDE, but it still necessary to specify it.
Comments
0 comments
Please sign in to leave a comment.