sure, i dont know lsp-mode; i use this in vim https://github.com/snoe/dotfiles/blob/master/home/.vim/coc-settings.json#L9-L10
followup question from yesterday: I have a checkout of clojure-lsp
, and I invoke lsp
in emacs
with:
(after! clojure-mode (setq lsp-clojure-custom-server-command '("bash" "-c" "cd /home/carlo/code/clojure/clojure-lsp && lein run")))
Then, I get the port via lsp-clojure-server-info
, and cider-connect
to localhost
and that port. However, in the repl, I get this warning:
WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! (More information)
In the documentation for cider
, I learnt that cider
injects automatically the middleware in the case of cider-jack-in
, but not in the case of cider-connect
. So I modified clojure-lsp/deps.edn
to have this section:
:aliases {:test {:extra-paths ["test"]}
:debug {:extra-deps {nrepl/nrepl {:mvn/version "0.8.3"}
cider/cider-nrepl {:mvn/version "0.25.9"}}}
:run {:main-opts ["-m" "clojure-lsp.main"]
:jvm-opts ["-Xmx2g" "-server"]}}
(note the cider-nrepl
addition). However, nothing changed. I suspect that is because I'm not really using the debug version, so I'm trying setting the command to:
lein with-profile :debug run ;; doesn't work
or other variations, but can't get cider-nrepl
to work properly. Ideas, @ericdallo?I think you can just inject the nrepl/nrepl in your lein profile
Example: https://gist.github.com/arnaudsj/9731521#file-profiles-clj-L2
do you mean cider/cider-nrepl
?
yeah
ok, now I have as my ~/.lein/profiles.clj
:
{:user {:dependencies [[org.clojure/tools.namespace "0.2.3"]
[spyscope "0.1.3"]
[criterium "0.4.1"]
[cider/cider-nrepl "0.25.9"]
[nrepl/nrepl "0.8.3"]]}}
and the command is still
(after! clojure-mode (setq lsp-clojure-custom-server-command '("bash" "-c" "cd /home/carlo/code/clojure/clojure-lsp && lein run")))
but I still have:
WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! (More information)
is that because I need to inject them myself somehow?Hum, I have no idea, never faced this warning. Maybe https://github.com/clojure-emacs/cider-nrepl/issues/597 can help?
no, that's where I learned the difference in behavior between cider-connect
and cider-jack-in
. I'm starting to thing that maybe what I want to accomplish might be impossible in the current tooling
Yeah, I never tried cider debug, and only used debug from DAP on other languages, and honestly the cider + clojure-lsp works pretty well to me to hack and code
Did you ask about that on #cider?
yes, yesterday, but no response yet; I'll see if I have more luck during the week
I understand that it might seem strange that I insist in trying to get this workflow right, but it would be my dream workflow for a project like this, and I'm dabbling in clojure to see how well I can optimize for happiness 😂
yes, I see your point 🙂
well, let me know if you manage to make it work
You need to call ciders main not lsp
Jack into a project that uses clojure cli and copy the jack in command printed at the top of the repl and modify it as you need
Hi. I noticied that sometimes I lose the arities of the the functions in the minibuffer, I think lsp errors override the minibuffer. Here's an example:
Is there a way to just underline the function and not the whole sexp?
For example, the first paren is underlined because I'm redifining the function and I get the warning when I move the point to that paren.
which editor is this? I found that VSCode did this too, so in the clj-kondo lsp server I worked around it like this: https://github.com/clj-kondo/clj-kondo.lsp/blob/90714f7d9a867110b003c24008c46ae4956c65c7/server/src/clj_kondo/lsp_server/impl/server.clj#L72
(note that this is not clojure-lsp)
emacs
flycheck + pure clj-kondo does this better imo
https://github.com/borkdude/flycheck-clj-kondo this one, right?
yes. you can turn off linting with the lsp plugin, that's how I do it locally. you will need to install the clj-kondo binary though
I already have it 🙂
Do I lose lsp intelligence if I turn off linting?
btw, to turn it off I added this to my ~/.lsp/config.edn file, is that enough?
:linters {:clj-kondo {:level :off}}
@juan.ignacio848 You can do this on the client side
lsp-diagnostics-provider :none
I think it's best to do it there. clojure-lsp still uses clj-kondo for analysis and it will also use information from findings
good, I was afraid to lose that part!
Ill try that
works perfectly, thanks
The minibuffer blinking between the arity and the linting error was driving me crazy 😛 and I like the arity message
Any tips how to improve this on clojure-lsp to avoid users need to disable that?
I don't get lsp errors/warnings on minibiffer, I'm not sure what we should improve
The above is what I needed to do to "fix" this in vscode
Could you elaborate? we have a pretty similar function in clojure-lsp: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/feature/diagnostics.clj#L10
My function is to avoid underlining the entire s-expression in case it's an expression with parens
even if it's on the same line (unlike your code, it seems)
I see, so it'll underline only the function name?
only the first paren
pretty much how flycheck does it by default when you don't give an end location
it's just that lsp requires an end location
yeah, I see the issue now
looks a good fix for now, I'll try to make that happen for clojure-lsp as well, thanks for the tip @borkdude
yeah, not sure if kondo should do this by itself, the end locations may be used by some tools for other purposes
yes, I agree
Fixed on latest release @juan.ignacio848 😄
Thanks @ericdallo! I'll try it after having dinner