Fork me on GitHub
#emacs
<
2023-09-08
>
lispers-anonymous21:09:25

The latest revision of clojure-ts-mode supports more traditional semantic indentation. It should be available on melpa (unstable) next time their build process runs now. https://github.com/clojure-emacs/clojure-ts-mode

šŸ†’ 13
ā¤ļø 23
šŸŽ‰ 7
emacs 9
šŸ”„ 4
Daw-Ran Liou22:09:08

Thank you very much for working on this! I'll give it a try at work on Monday šŸ™‚ I've been using the indentation rules from clojure-mode so far so the indentation is consistent with my colleagues'.

lispers-anonymous23:09:20

Appreciate the kind words. I have tried match clojure-mode's out-of-the-box indentation. If there are any discrepancies feel free to open up an issue. Keep in mind I haven't added support for things like clojure-indent-style yet. clojure-ts-mode should behave like the always-align value for that.

ā¤ļø 2
Daw-Ran Liou23:09:08

Kk thanks! Lucky me that always-align is what I use at work šŸ™‚

šŸ¤ 2
vemv10:09:50

Very good news - needless to say there's much history behind semantic indentation so it would be hard to imagine Emacs / CIDER without it :)

lispers-anonymous13:09:31

Indeed. It's been one of the more difficult features to implement. Having Tonsky's fixed indentation spec he wrote was very convenient and an easy way to get started. From what I understand many people were also pulling in clojure-mode and enabling it's indentation with clojure-ts-mode. A strong signal that this was a desired feature.

āœ… 4
gratitude-thank-you 2
bozhidar17:09:38

Will this be the default now?

lispers-anonymous19:09:23

Yeah, it is https://github.com/clojure-emacs/clojure-ts-mode/blob/58f3c835aeafe0378ab9693731b95096827dbb24/clojure-ts-mode.el#L582. I'm not going to cut a release quite yet though. I think there is a regression in emacs 30 causing some of the indentation to not work. I'm not sure if I caused it or it's on the Emacs side. Doing a slow painful git bisect right now to hunt that down.

šŸ‘ 2
lispers-anonymous20:09:31

Another fun feature is I'm using a markdown grammer in docstrings to highlight \symbols-in-backticks\`` . I'm not aware of any of the other tree-sitter modes using nested parsers like this yet.

nice 5
lispers-anonymous20:09:41

It could be used to do more intricate markdown highlighting. I've found the more complex the queries get, the more likely nested parsing is to break, so keeping things simple now. I have a branch that does something similar with regular expression literals, but those queries have the potential to "overflow" out of regex literals into the rest of the buffer. Not sure what is happening with that, but it's some kind of problem in emacs.

Daw-Ran Liou16:09:50

Hey just want to report back that the semantic indent style works great so far. The syntax-table seems to match the one in clojure-mode now and I appreciate the efforts to achieve the feature parity. šŸ™

Daw-Ran Liou16:09:48

I still need to manually override the treesit sexpr changes despite of 623c98292f9207a95169cdeae6f8595c016c6320 but Iā€™m okay to have it in my own config.

lispers-anonymous02:09:21

I've put the transpose-sexp workaround back in place until it's fixed in upstream Emacs 30. See https://github.com/clojure-emacs/clojure-ts-mode/commit/5f16fb8dbcaf9476cc6d5baab958b730cb60e854

šŸ™‡ 1