Update on this: I found the cause: β’ I had treemacs sync mode on β’ In treemacs I had an inner folder registered as a project. Treemacs doesn't allow projects that overlap. β’ Removed it, now works fine
Hey @ericdallo, I have a question on tooling: I open the clojure-lsp
project in emacs, then open the file clojure-lsp/test/clojure_lsp/features/call_hierarchy_test.clj
(at which point my lsp server auto-starts), then I do cider-jack-in-clj
(with clojure-cli
). Then I try to evaluate the clojure-lsp.features.call-hierarchy-test
namespace I'm in with M-x cider-eval-buffer
, and I get:
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling test/clojure_lsp/features/call_hierarchy_test.clj at (1:1)
#:clojure.error{:phase :compile-syntax-check,
:line 1,
:column 1,
:source
"/home/carlo/code/clojure/clojure-lsp/test/clojure_lsp/features/call_hierarchy_test.clj"}
Compiler.java: 7652 clojure.lang.Compiler/load
REPL: 1 user/eval22442
REPL: 1 user/eval22442
Compiler.java: 7181 clojure.lang.Compiler/eval
Compiler.java: 7136 clojure.lang.Compiler/eval
core.clj: 3202 clojure.core/eval
core.clj: 3198 clojure.core/eval
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1977 clojure.core/with-bindings*
core.clj: 1977 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 662 clojure.core/apply
regrow.clj: 20 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 202 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 201 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 834 java.lang.Thread/run
1. Caused by java.io.FileNotFoundException
Could not locate clojure_lsp/test_helper__init.class,
clojure_lsp/test_helper.clj or clojure_lsp/test_helper.cljc on classpath.
Please check that namespaces with dashes use underscores in the Clojure file
name.
Am I doing something wrong?Could you try jack in as a lein project?
thanks @ericdallo, jack-in as lein works. Could you explain me why that's the case? Isn't the presence of a deps.edn
file enough for clojure-clj
?
the clojure-lsp is actually a lein project that read the dependencies from deps.edn file, we need to migrate to full dep.edn π
1πref: https://github.com/clojure-lsp/clojure-lsp/tree/only-deps.edn
If you try using the clojure cli again does it work? Itβs been a bit but I think thereβs some Java that lein compiles that clj obviously doesnβt know about
yes, @dpsutton is correct, that branch I refered fix that, but we need to fix other things to that work as well
Another question: in my emacs setup I have (setq lsp-clojure-custom-server-command '("bash" "-c" "cd /home/carlo/code/clojure/clojure-lsp && lein run"))
.
I open emacs, visit the file clojure-lsp/src/clojure_lsp/feature/call_hierarchy.clj
, jack-in using lein, use cider-eval-defun-at-point
with an universal argument to toggle the debugging on the function incoming
, then I call M-x lsp-treemacs-call-hierarchy
on element-by-uri->incoming-usage-by-uri
, expecting the call to be intercepted and debugged via cider (it has to pass via the incoming
function). But that doesn't happen. What am I missing?
I never used that as (setq lsp-clojure-custom-server-command '("bash" "-c" "cd /home/carlo/code/clojure/clojure-lsp && lein run"))`` not sure why you need that.
these are the steps I do to work:
1. I generate a local release to test with lein with-profile :debug bin
2. I point emacs to use that release: (setq lsp-clojure-custom-server-command '("bash" "-c" "~/dev/clojure-lsp/target/clojure-lsp"))
3. I open the https://github.com/ericdallo/clojure-sample, (could be any clojure project) and and wait until LSP starts.
4. I get the port of the running clojure-lsp on the project with lsp-clojure-server-info
, it should print a :port xyz
5. I go to clojure-lsp and use cider-connect-clj
and pass the port xyz
6. Now every function I eval on clojure-lsp project, it will affect the running session of clojure-lsp on my sample project
let me try this again then. I seem to remember that the problem with this approach is that if you use cider-connect-clj
you won't have cider-nrepl
middleware automatically injected, and so you won't be able to flag functions for debugging in cider. Is there a workaround for that? @dpsutton mentioned connecting to the repl the way clojure-clj does it (which, as I understand, injects the appropriate middlewares) which is what brought me to the previous question
so, in your method, does universal-argument M-x cider-eval-defun-at-point
work?
Good question, never tried that, but you could add the middleware manually I think via some cider variable?
that's the thing, from my admittedly little experience, I think a middleware has to be injected in the nrepl initialization, and I didn't find a way to do it only from the emacs side
Maybe https://docs.cider.mx/cider/0.26/basics/middleware_setup.html#using-leiningen ?
or cider-jack-in-nrepl-middlewares
the documentation for lein you linked suggests to add something like
{:repl {:plugins [[cider/cider-nrepl "0.25.2"]]}}
to the project.clj
. I modified the :debug
section (since it seems to be the one I'm invoking:
:debug ^:leaky {:dependencies [[nrepl/nrepl "0.8.3"]
[cider/cider-nrepl "0.25.9"]]}
that worked?
but I'm not sure on the invocation:
$ lein with-profile :debug bin
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Performing task 'bin' with profile(s): ''
Warning: profile : not found.
WARNING: seqable? already refers to: #'clojure.core/seqable? in namespace: clojure.core.incubator, being replaced by: #'clojure.core.incubator/seqable?
WARNING: seqable? already refers to: #'clojure.core/seqable? in namespace: clostache.parser, being replaced by: #'clojure.core.incubator/seqable?
Warning: profile : not found.
Warning: profile : not found.
Warning: profile : not found.
try with:
lein with-profiles +debug bin
ok that eliminates the warning, why does +debug
work instead of :debug
which is what's written in project-clj
?
when you +profile , lein add that profile to the existing instead of using only the one you provided
I don't know why that removes the warning though
Still need some corner cases fixes though, but it's working nice π
you might also want to add clj-kondo.lint-as/def-catch-all
to this list
which works for weirder def-like macros
yes!
and I would probably remove ->
since I have almost never encountered this in lint-as
oh you have, well, then leave it :)
Cursive thas that, I don't see any harm keep it, right?
no harm. good job!
Thank you for the help! I'm glad this worked π
LSP is quickly becoming the most complete IDE after Cursive
I hope you get funding by CT
1βοΈYeah π That'd be really good π
Was there a survey announcement recently? Haven't seen one
No, I think they will start the voting on april
they were closing the members register this month
So how did it end with the incremental diffing? reverted it?
yeah, but usually they send out a survey to the sponsors before this
to see which projects should get funded by the opinion of the sponsors
I will ask Daniel
> So how did it end with the incremental diffing? reverted it? I still need to find the out-of-sync corner case issue, it's behind a feature-flag
Oh, got it
I was thinking, maybe generative testing could be used to find this corner case
yes, it could help indeed, I think we could improve the integration tests to be able to do that
the clojure-lsp integration tests base is working good
is it a problem with the async stuff, or with the diff function?
Probably the async stuff
the diff function seems to work good
also it seems to happen with medium/big buffers
Maybe you can test it by putting some random Thread/sleeps into the async handlers
hum, good idea indeed
Btw, I will probably make a new clj-kondo release tonight with a bunch of bug fixes in it
good to know! I'll include in this feature release if don't find any issues with that bump π€
thanks for telling me
I will push one more fix to master within the next two hours
1πPushing 2021.03.21, will be on clojars in a few minutes hopefully
Nice, I'm finishing the resolve macro as, then I'll bump clj-kondo, if everything goes fine, I'll release it later tonight
I love this bot π https://github.com/clojure-lsp/clojure-lsp/pull/375
Hmm, I found one more edge. I will do another release tonight
π , I'll wait for clojure-lsp release so
:clojure-lsp:Β ReleasedΒ https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.03.21-23.29.19Β version:
β’ Bump a lot of libs: rewrite-clj (v1), lsp4j, guava, data.json
β’ Add new code action: Resolve macro as...
π :
The Resolve macro as
feature asks to user how clj-kondo should lint that macro from common used macros only (for now), and on what clj-kondo config file it should save the :lint-as
map.
Thanks to @borkdude and @lee for the help to make that happen.
This feature was something that since I started programming Clojure I missed on other editors than Cursive and now that is possible starting from Emacs editor (make sure to update lsp-mode
package) π
amazing
Thanks! Just updated π
2π@brandon.ringe LMK if need any help setting up that new action on Calva, it will need to code something for that work
1π