tree-sitter-kotlin icon indicating copy to clipboard operation
tree-sitter-kotlin copied to clipboard

Add syntax highlighting queries

Open Wilfred opened this issue 3 years ago • 3 comments

This is largely based on the nvim-treesitter highlighting, but enables other tree-sitter-kotlin projects to include syntax highlighting.

Wilfred avatar Apr 18 '22 00:04 Wilfred

Wow, this is pretty cool, thanks!

I haven't looked that much into tree-sitter's built-in support for syntax highlighting yet, but I hope to find some time to do so soon and get this merged.

fwcd avatar Apr 18 '22 01:04 fwcd

Tree sitter wasm is giving me some errors with this one RangeError: Bad node name 'character_escape_seq' and when I comment that one out I get Bad node name '' (seems something with the operator section, but can't figure out what)

Edit: "?." and "!is"

MolotovCherry avatar Jun 02 '22 23:06 MolotovCherry

Has there been any update on this pr? I'm keen to try it! :)

RenFraser avatar Sep 23 '22 12:09 RenFraser

Finally got a chance to play with this in Neovim [1] and with some minor tweaks in 05ef579 to update it for the current grammar I could get this to work. Thanks a lot for looking into this!

Going forward we should make sure that CI tests the queries to make sure that the node names stay in sync, but that is out-of-scope for this PR.

[1] If anyone would like to try this out:

  • Compile the parser to a dynamic library using make (thanks to #58 this is pretty easy now!)
  • Place it under <runtimepath>/parser/kotlin.{dylib,so}
  • Place the queries under <runtimepath>/queries/kotlin/highlights.scm
  • Run :lua vim.treesitter.start() in a Neovim instance from a Kotlin source file

fwcd avatar Jun 28 '23 14:06 fwcd

Great news thanks @Wilfred and @fwcd. Could we make a new release so that we can update treesitter with TSUpdate? :)

RenFraser avatar Jun 30 '23 03:06 RenFraser