Open megayu opened 2 years ago
Hello, thanks for the request!
It could be a bit tricky to get auto-restart to work correctly. Configs can reside in many places. And it could also be undesirable in some situations to pay the price of a full reload of clojure-lsp when you just want to save your change.
What would be pretty easy to add and keep things simple is a Restart clojure-lsp commands. Then you can bind it to a keyboard shortcut to easily get it done after save.
I think add a Restart clojure-lsp command is a good idea.
If I'm not mistaken clojure-lsp should catch changes to the config files and updated its running-config. Is this also true for the clj-kondo config @ericdallo?
yes, but there are a few things to consider, clj-kondo reads the config every time it's called, we call clj-kondo mostly on 2 places:
Also, clojure-lsp is smart enough to know a clj-kondo config changed and invalidate the cache linting whole classpath again to avoid false-positives
I've created an issue for adding a command to restart clojure-lsp, FYI: https://github.com/BetterThanTomorrow/calva/issues/1727. Someone asked if there was a way to restart it with a shortcut in Slack today.
@megayu, are you aware of Joyride? It is an extension that @borkdude and I have created very recently, that lets you script VS Code.
Once you've installed Joyride, this keyboard shortcut restarts clojure-lsp.
{
"key": "cmd+f4",
"command": "joyride.runCode",
"args": "(require '[promesa.core :as p]) (p/do (vscode/commands.executeCommand \"calva.clojureLsp.stop\") (vscode/commands.executeCommand \"calva.clojureLsp.start\"))"
},
I would probably define a function for it in some my-commands
namespace during Joyride activate and call that function instead. This will keep the shortcut simpler. And such a namespace is a natural place to start writing code like this and get it right using the REPL. I will add an example recipe for this to Joyride, I think.
Yes, I saw the video in YouTube before, it sounds good for me.
Related issue: https://github.com/BetterThanTomorrow/calva/issues/1113
According to https://clojure-lsp.io/settings/#diagnostics-linter and https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md, we can define an config.edn file under ".clj-kondo" directory, each time i change this file i had to stop the clojure-lsp server first then start it again to make it work, it's not too convenient.