Skip to content

Classify more hard keywords as such in the grammar #150

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

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

ks-korovina
Copy link
Contributor

This is more consistent with how other languages classify tokens, and better compatible with color themes. Also, IntelliJ doesn't make a distinction between different hard keywords, so we likely don't need to, either.

storage.type scope seems to be a better fit for types, not declaration kinds. Examples:

  • Java grammar using storage.type.primitive.array.java for boolean[], storage.type.local.java for its var (which is "type"-y), storage.modifier.java for "class" and keyword.other.package.java for "package".
  • Go grammar using keyword.function.go for func, storage.type.boolean.go for bool.

There is another issue with keywords in this case which I couldn't fix right away: in fun f(a: suspend () -> Unit), suspend is classified as entity.name.type.kotlin. IIUC, this is because somehow we end up in type-parameter rule instead of in keywords.

grammar.
This is more consistent with how other languages
classify tokens, and better compatible with color
themes. Also, IntelliJ doesn't make a distinction
between different hard keywords, so we likely
won't need to, either.
IIUC, the `storage.type` scope
is a better fit for types, not declaration kinds.
@fwcd fwcd added the grammar Related to the TextMate grammar, i.e. syntax highlighting label Jul 28, 2024
@fwcd
Copy link
Owner

fwcd commented Jul 28, 2024

Nice, thanks for looking into this!

@fwcd fwcd merged commit afe03ed into fwcd:main Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grammar Related to the TextMate grammar, i.e. syntax highlighting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants