Fork me on GitHub
#tree-sitter
<
2023-09-25
>
lispers-anonymous13:09:01

clojure-ts-mode 0.2.0 released last night. Notable features include ā€¢ Semantic indentation ā€¢ Better highlighting of docstrings and names in forms like deftype, defprotocol, reify, etc More info in https://github.com/clojure-emacs/clojure-ts-mode/blob/main/CHANGELOG.md#020

1
šŸŽ‰ 1
šŸ‘ 2
Noah Bogart13:09:07

how portable are these changes? could they be merged into a vim ts plugin?

lispers-anonymous16:09:36

These changes only work in the Emacs major mode. The way Emacs tree-sitter integration works does not translate directly to what other editors like neovim do unfortunately.

šŸ˜¢ 1
Noah Bogart16:09:01

bummer. thanks tho, this is a good update for y'all

lispers-anonymous16:09:38

Indeed. People writing tree-sitter-clojure integrations in other editors are free to take inspiration of course. The semantic indentation has a lot of supporting emacs lisp that is required. Other tree-sitter powered modes are more portable. Clojure is kind of an exception because a lot of the semantic meaning behind clojure code is only defined at compile time and runtime (see: macros) Because of that tree-sitter-clojure grammar only defines extremely basic syntax. Most grammars provide nodes for things like functions and variable declarations. tree-sitter-clojure only exposes things like "list" "symbol" "keyword". It doesn't apply any semantic meaning because it can't execute the code. This results in editor modes having to figure that stuff out on their own. The result is less portability.

lispers-anonymous16:09:34

Sorry if that is repetitive. I think I said something similar in the last thread lol.

Noah Bogart16:09:15

no you're good. i spent a bit of time trying to contribute to the tree-sitter-clojure repo, so i know about the issues of writing ts queries for clojure. we have pretty solid syntax highlighting in nvim-treeesitter but no indentation (and the existing indentation solutions are pretty poor). i'll take a look at what you've done, see if i can adapt it!

lispers-anonymous16:09:00

Good luck and let me know if you have questions