lsp

JR 2025-12-12T19:23:05.067219Z

In the clojure-lsp refactorings, I realized that I didn't see much for automatic code formatting (specifically, indentation) during/after a refactor. Poking around in the docs, it seems like formatting is only done when textDocument/formatting (or rangeFormatting) is sent from the client. Is this correct? If so, I guess the approach for refactoring code is to get the code into approximately the correct form (wrt whitespace) and expect that the user reformats afterward?

ericdallo 2025-12-12T19:24:39.280799Z

yes, we do it after clena-ns only, and it's optional by a opt-out flag

ericdallo 2025-12-12T19:24:53.969569Z

but yeah, I think we could think in a global apply format after refactor flag

JR 2025-12-12T19:27:14.033599Z

Maybe it would be nice... but I wasn't actually missing it as a user. At least not yet. I was just looking at unit tests and realized I hadn't thought much about formatting the transformed code for some reason! But yeah, as a user it would probably be a nice to have

ericdallo 2025-12-12T19:28:36.252029Z

one of the reasons was that cljfmt is slower for formatting regions than a full string/buffer

👍 1