Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: LowbugSomething isn't workinggrammarTextMate grammar / syntax highlightingv1.5.0Targeted for the v1.5.0 milestone

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions