Fork me on GitHub
Kiyanosh Kamdar16:05:34

Hello Team, I’ve got multiple root folders inside my workspace from multiple repos. Clojure-lsp server info picks up the very first root folder to set the project-root-uri value. Unfortunately this is the incorrect one. Is there a way to configure the value? I didn’t find anything in VScode that let’s me set a root project folder.


I don't think Calva offers a way to do this... We probably can make it so. Please file an issue about it.


You might get away with placing a deps.edn in the root folder that is picked up and use :local/root to point it at the root that is the correct one. Not sure if clojure-lsp will play along...

Kiyanosh Kamdar16:05:38

no worries, thanks


My solution to that was to put .lsp/config.edn in the "first" root folder pointing to the correct "root" deps.edn and I added a shell script to compute the classpath since my "default classpath" requires aliases to be specified.


{:project-specs [{:project-path "<root-path>/deps.edn"
                  :classpath-cmd ["./.lsp/"]}]}
cd <root-path> && clojure -Spath -M:build:dev:everything:runner:test
Ugly, but it works 🙂

metal 2
❤️ 2
Stefan T20:05:42

Aside from restarting LSP, is there an easy way to refresh kondo lint errors after making changes to the kondo config? I’m finding that I have to restart LSP/kondo to get those changes to take, which can be very time consuming.


if you change a kondo config, and edit the file, clojure-lsp will already use the updated config, but keep in mind that it will not update all project diagnostics, a restart does that for you

Stefan T20:05:33

Gotcha. I guess then my question is whether it was possible to update project diagnostics after making config changes to avoid a restart. I could imagine why that might be complicated, I imagine the most correct thing to do would be to rerun kondo over the entire classpath after a config change? Though to me the biggest frustration is that errors stay around in files that I have open. Do you think there’s an easy solution that would do something like reset the diagnostics for open files after changing the config?


yeah, scanning the whole project would not worth as a restart already does that, scanning open files would work I guess, but the effort to implement that would not worth as well IMO


I agree about not worth it. It might not even be what the user wants right then and there.


You can make a #joyride script that stops and starts the clojure-lsp server and bind it to a keyboard shortcut. Won't save much time, but at least be quite convenient.

🤯 2
👍 1
Stefan T21:05:11

Totally get priorities and such, this is a nice-to-have. I was hoping to avoid having to restart LSP all together just to change the kondo config, but maybe I’m just impatient 🤷


I think clojure-lsp will not be very useful during the update of all project diagnostics, wether it is from a restart or not. And it will take roughly the same amount of time. The win would be a convenience thing. If you do that #joyride clojure-lsp stop/start on a file-watcher. you'll have something very similar to what it would be like if clojure-lsp did the full update automatically.