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

Fix token types to use LSP token types #367

Merged
merged 17 commits into from
Mar 26, 2024

Conversation

DavyLandman
Copy link
Member

@DavyLandman DavyLandman commented Mar 20, 2024

The original implementation was half working, due to an incorrect interpretation of the standard. This commits fixes that. For backwards compatibility: it still supports the legacy ones from rascal and also the wrong text-mate ones.

The rendering of Rascal is the same, except that string and numeric literals are now both highlighted as string (where before they were not highlighted). This is something we can only fix in the rascal grammar.

Also, side-effect, the list of tokens send to the client is less, as we only try and send those that have an category and not all the plain ones.

Fixes #366

TODO:

  • extend documentation for DSL
  • (not part of this PR) tune categories in Rascal grammar

The original implementation was half working, due to an incorrect interpretation of the standard.

This commit fixes that, but also adds modifiers

Fixes #366
@DavyLandman DavyLandman force-pushed the feature/improve-syntax-highlighting-mapping branch from 36424ac to 515436d Compare March 20, 2024 12:32
@DavyLandman DavyLandman changed the title Support LSP token types and modifiers Fix token types to use LSP token types Mar 20, 2024
@DavyLandman DavyLandman marked this pull request as ready for review March 20, 2024 12:49
@DavyLandman DavyLandman force-pushed the feature/improve-syntax-highlighting-mapping branch from 672e19a to 72d58d6 Compare March 20, 2024 12:51
Copy link

@urbanfly urbanfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat to see how this works under-the-hood.

@urbanfly
Copy link

Will this PR make syntax highlighting Rascal code itself better/different? (like numbers in Rascal code will now be distinct?)

@DavyLandman
Copy link
Member Author

Will this PR make syntax highlighting Rascal code itself better/different? (like numbers in Rascal code will now be distinct?)

Yes, they will now be highlighted (since before they were just the regular text color). But it requires some further tuning to get a difference between the string literals and the numeric literals.

@DavyLandman
Copy link
Member Author

I want to merge this, but the windows runner is crashing on something weird. same case for main branch.

Copy link

@DavyLandman DavyLandman merged commit c237e91 into main Mar 26, 2024
11 checks passed
@DavyLandman DavyLandman deleted the feature/improve-syntax-highlighting-mapping branch May 31, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rascal LSP uses textmate token scopes where it should use SemanticTokenTypes for the syntax highlighting.
2 participants