rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Introduce a fixed set of syntax highlighting categories to replace the old string based categories in parse trees

Open DavyLandman opened this issue 1 year ago • 1 comments

Right now people writing a grammar can add @Category annotations on their productions to get syntax highlighting in their IDE. It's been a bit of a mixed bag of what to write vs what you'll get. usethesource/rascal-language-servers#366 was a recent case of this misalignment.

After some more discussions with @jurgenvinju we came to the following design:

  • ParseTree gets a new ADT called Highlight
  • We use a fixed set of highlight categories (that happen to mirror the LSP SemanticTokenType categories)
  • Production rules can now be annotated with either the deprecated @Category or the new @Highlight=number()

DavyLandman avatar Mar 22 '24 13:03 DavyLandman