[STAL-2736] feat!: switch upstream Kotlin parser #504
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem are you trying to solve?
Currently the Kotlin grammar we use is from a third-party repository, and there are some open issues w.r.t parsing. Not only that, but certain queries take a very long time; the lag while typing in the rule editor is very noticeable.
What is your solution?
The new grammar I wrote that lives in the
tree-sitter-grammars
org parses Kotlin more correctly and is easier to query since the parse tree is simpler. It also removes the noticeable lag when editing with the old Kotlin grammar, and is also an actively maintained grammar with support from tree-sitter & neovim contributors.Alternatives considered
What the reviewer should know
Kotlin supports block comments, so I moved the match arm in
get_lines_to_ignore
to be with JS/TS which checks for two slashes and a slash + asterisk, instead of just two slashes.