Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DavyLandman opened this issue Mar 22, 2024 · 1 comment
Assignees

Comments

@DavyLandman
Copy link
Member

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()
@jurgenvinju
Copy link
Member

Thanks Davy. Minor note: the coding standard for tags is to start with lowercase, and for ADTs with uppercase. This helps to pry apart Highlight the ADT from @highlight=keyword() the tag name. Just like @synopsis{...}

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

No branches or pull requests

2 participants