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

Improved grammar for kotlin based on official documentation #3407

Merged

Conversation

per-steinar
Copy link
Contributor

PR improves kotlin grammar based on documentation from https://kotlinlang.org/docs/home.html
Resolves #3403

@rgrunber rgrunber requested a review from jdneo November 30, 2023 18:45
@rgrunber
Copy link
Member

As long as we've made an attempt to upstream the work, at eclipse/buildship#1273, I'm fine with getting it in here sooner. @jdneo , feel free to merge if it all looks good to you.

@jdneo
Copy link
Collaborator

jdneo commented Dec 1, 2023

Hi @per-steinar, thank you for your contribution!

Looks like lots of cases will be improved with this PR. If possible, would you mind give the improved sample snippets as comment here?

@per-steinar
Copy link
Contributor Author

per-steinar commented Dec 2, 2023

@jdneo Most of the changes are only vissible when inspecting the textmate scopes, but i have added the most vissible ones:

What is chaged Before After
val and var scopes image image
Optional and assignment operator in functions image image
elvis operator (the optional accessor (?.) is also scopet, but my theme does not have a color defined for it) image image
"to" keyword for mapping image image

Signed-off-by: Per-Steinar Karlsen <[email protected]>
Copy link
Collaborator

@jdneo jdneo left a comment

Choose a reason for hiding this comment

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

Tried on a simple gradle kotlin dsl: the token mainClass has a different color now

before:
before

after:
image

@jdneo jdneo added this to the End December 2023 milestone Dec 5, 2023
@jdneo jdneo merged commit d186e12 into redhat-developer:master Dec 5, 2023
2 checks passed
@jdneo
Copy link
Collaborator

jdneo commented Dec 5, 2023

Thank you @per-steinar!

@@ -21,10 +21,13 @@
],
"repository": {
"import": {
"begin": "\\b(import)\\b\\s*",
"begin": "\\b(import)\\b\\s?([\\w+.]*\\w+)?\\s*",
Copy link
Contributor

Choose a reason for hiding this comment

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

This rule unfortunately isn't quite correct and matches the package name as a modifier token, see: fwcd/vscode-kotlin#137 (comment).

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

Successfully merging this pull request may close these issues.

Improved support for textmate definition for kotlin dsl
4 participants