Skip to content

< and > operators red in Dark+ theme inside XML CDATA injection #138

@michaeldistel

Description

@michaeldistel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggrammarTextMate grammar / syntax highlighting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions