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

Generated textmate grammar highlights punctuation characters as invalid #3337

Open
iTob191 opened this issue Feb 5, 2025 · 2 comments
Open

Comments

@iTob191
Copy link

iTob191 commented Feb 5, 2025

A textmate grammar generated by the TextMateHighlightingFragment does not contain a rule for punctuation. As a result, any punctuation characters are picked up by the invalid rule and highlighted accordingly.

I've looked at the code and basically every keyword that does not match \w+ is ignored here and will then be picked up by the invalid rule.

@cdietrich
Copy link
Contributor

@iTob191 can you work on a fix?

@iTob191
Copy link
Author

iTob191 commented Feb 20, 2025

I'm not really sure how to best resolve this.

  1. What textmate scope to use? The naming conventions aren't really clear regarding punctuation characters. VS Code uses different scopes for different punctuation characters, for example for typescript: keyword.operator.ternary.ts, punctuation.separator.comma.ts, meta.brace.square.ts, ...
  2. Creating a punctuation rule for everything that is not matched here would be a simple solution to prevent valid tokens to be highlighted as errors. But it feels wrong to classify everything that does not match \w+ as punctuation.

For my personal use case, this simple solution with a scope named punctuation.languagename would be sufficient. And I guess it would be sufficient for most languages and certainly an improvement over the current situation.

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

No branches or pull requests

2 participants