tree-sitter

lispers-anonymous 2022-12-06T13:48:21.775139Z

Wow, I was thinking about creating a tree-sitter channel but it turns out there already is one.

lispers-anonymous 2022-12-06T13:49:03.219549Z

I am working on this issue in clojure-mode: https://github.com/clojure-emacs/clojure-mode/issues/640 And figured this would be a great place to chat about it and post updates on my progress instead of spamming the clojure mode issue

lispers-anonymous 2022-12-06T14:00:01.606359Z

So far: I recently got distinct highlighting on the namespace and name parts of keywords and symbols. I'm now trying to get distinct highlighting for typehints and metadata sugar like this ^:added-metadata

lispers-anonymous 2022-12-06T18:58:35.405149Z

Metadata syntax highlighting is working great now. I can pretty easily apply type face to typehints, property face to metadata. I've added preprocessor face to reader tags, comment-delimiter face to the discard tag, warning face to deref symbol. Quote syntax ``~@` and var quotes #' have a delimiter face.

lispers-anonymous 2022-12-06T19:00:20.460509Z

Turning off rainbow delimiters, brackets and the set literal # have a delimiter face. edit: did not mean to sent this to channel.

Cora (she/her) 2022-12-07T00:52:56.976439Z

do you know how this might interact with lap's highlighting?

lispers-anonymous 2022-12-07T02:56:47.397089Z

Do you mean lsp's highlighting? I can't imagine it will be different from how it works today, since I think lsp applies highlighting after the major mode does. I haven't done much testing, but with eglot and clojure-lsp it still does things like highlight matching symbols when the cursor is over it.

Cora (she/her) 2022-12-07T02:57:59.539099Z

right, that's my understanding, it enhances the major mode's highlighting, but I was curious if tree-sitter changes that at all

Cora (she/her) 2022-12-07T02:58:56.731879Z

I've also wondered as a pie-in-the-sky thing if tree-sitter couldn't be integrated into clojure-lsp but that's not super relevant here

lispers-anonymous 2022-12-07T12:19:18.389939Z

Well I can say for sure that eglot with clojure-lsp work well with my tree-sitter branch. I can imagine lsp-mode will as well, but I don't use that library personally. I'm not sure what clojure-lsp would gain by using tree-sitter. I believe it already uses rewrite-clj to fill a similar role as what tree-sitter would do. Maybe it would be faster to parse, but I'm not sure what else it brings to the table. The lsp maintainers might be interested though