Summary
When ST code is highlighted inside TwinCAT/CoDeSys XML export tags via the XML injection grammar, the < and > comparison operators appear red in Dark+ (and similar) themes.
Root cause
The VS Code XML grammar claims CDATA blocks as string.unquoted.cdata.xml before the injection grammar can take ownership. Even with R: injection priority and - string exclusion, the string scope leaks into the ancestor scope stack for the embedded content. Dark+ colours all string scopes #ce9178 (orange-red), which overrides keyword.operator.comparison.st.
Acceptance criteria
< and > inside CDATA ST content render as operator colour (grey/white in Dark+), not red
- All other ST operators and keywords unaffected
- XML highlighting outside the injection blocks unaffected
Possible approaches
- Find an injectionSelector combination that fully prevents
string.unquoted.cdata.xml from appearing as an ancestor scope inside the embedded block
- Override the
string.unquoted.cdata.xml scope colouring in the extension's contributes.configurationDefaults for editor.tokenColorCustomizations
- Rename
keyword.operator.comparison.st to a scope that is not overridden by the string ancestor rule in common themes
Summary
When ST code is highlighted inside TwinCAT/CoDeSys XML export tags via the XML injection grammar, the
<and>comparison operators appear red in Dark+ (and similar) themes.Root cause
The VS Code XML grammar claims CDATA blocks as
string.unquoted.cdata.xmlbefore the injection grammar can take ownership. Even withR:injection priority and- stringexclusion, thestringscope leaks into the ancestor scope stack for the embedded content. Dark+ colours allstringscopes#ce9178(orange-red), which overrideskeyword.operator.comparison.st.Acceptance criteria
<and>inside CDATA ST content render as operator colour (grey/white in Dark+), not redPossible approaches
string.unquoted.cdata.xmlfrom appearing as an ancestor scope inside the embedded blockstring.unquoted.cdata.xmlscope colouring in the extension's contributes.configurationDefaults foreditor.tokenColorCustomizationskeyword.operator.comparison.stto a scope that is not overridden by thestringancestor rule in common themes