The latest clojure-lsp has become more instable for me than the previous one. E.g. when I do clojure-sort-ns
in emacs (powered not by LSP), lsp locks up emacs and CPU spikes to 100%
Unfortunately I don't have time for a repro now
Spoiler:
You can pass --project-root
and --namespaces
It works better than I thought 😄
And I accidentally linted my entire project 😆
:-D
I liked the API as well, using tools.cli
:thumbsup:
Need to work in some corner cases and integration tests for that (:babashka:) then I can announce as experimental 🙂
c/c @vemv
@ericdallo Can you configure what it will "fix"?
And does it also remove unused vars... and unused locals... that can be a bit dangerous I guess :)
Nice! Looking forward to that API :)
ATM no, but it'd be easy to introduce opt-outs.
it cleans only the ns
form, maybe clean-ns
as the api would be more clear
Perhaps you could configure this in .lsp/config.edn
what to "automatically" fix on a CLI invocation
similar to what carve does
also with ignores, etc
yes, I made the API consider the .lsp/config.edn as well, so it'd be easy to introduce customizations
e.g. with carve you can specify which vars to ignore or define "API" namespaces so unused vars are left alone
but I guess that can be just the config of the unused-var linter in lsp in general
no warning = no action
yes, I need to test, but if you configure your linter that way it may work as expected 🙂
no warning = no action (only sort, that could be disabled in a future setting as well)
yeah, cool.
Hum, odd, could you try disabling LSP formatting ?
lsp-enable-fornatting I think
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
lsp-headerline-breadcrumb-enable nil
company-idle-delay 0.5
lsp-idle-delay 0.5
company-minimum-prefix-length 1
;; lsp-lens-enable t
lsp-enable-file-watchers nil
lsp-file-watch-threshold 10000
lsp-signature-auto-activate nil
lsp-clojure-custom-server-command '("/Users/borkdude/Dropbox/bin/clojure-lsp")
lsp-diagnostics-provider :none
lsp-enable-indentation nil ;; uncomment to use cider indentation instead of lsp
;; lsp-enable-completion-at-point nil ;; uncomment to use cider completion instead of lsp
lsp-completion-provider :capf)
so add lsp-enable-formatting nil
?
lsp-enable-on-type-formatting nil
Yes, you can add both to test if performance is changed
It seems I got clojure-mode stuck in a loop
:thinking_face: maybe a profiler can help understand which function
clojure-sort-ns it was
Hum, maybe #emacs can help on that, meanwhile you can try lsp-organize-imports
Any reason for not using the LSP way?
Inertia
thanks for organize-imports, will try that next time!
oh it will also sort referred vars? niiice
dude, you really have to expose this stuff as a library
Yes hahah
I mean, there's no reason why you couldn't have this stuff as a git pre-commit hook or so right
Yeah, I was thinking in taking that issue and making it available via REPL
Or lib
I think lib is nice. You could also expose it via the command line (e.g. using sci) via scripts, or as a babashka pod
Hum, good idea
So lib first (designing API is the hardest problem probably?) and then you can build the rest on top of it: scripting, pod
Yes, I think API and how to manage the classpath is the probably ATM
Probably, it'd need to passa the project root or something
To clojure-lsp scan the project with kondo
yeah
but perhaps that can also just leverage the existing .lsp
config
Yes, IMO it should use the same config as it uses today
Looks nice, I'll take a look on it later, thanks for the tip
:thumbsup: :D
I think I could also deprecate carve possibly, since the logic in clojure-lsp can do much more
over time
Yes, ATM the clean-ns sort and remove unused require/refers/imports
lsp-organize-imports does this right? it works really neat!
yes, it calls the clean-ns
code-action under the hood
TIL! https://twitter.com/borkdude/status/1408452763915374592 Thanks @ericdallo
That's awesome!