This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-21
Channels
- # announcements (2)
- # asami (8)
- # aws (4)
- # beginners (32)
- # calva (12)
- # cider (72)
- # clj-kondo (16)
- # clojure (11)
- # clojure-germany (2)
- # clojure-italy (4)
- # clojure-serbia (2)
- # clojurescript (26)
- # data-oriented-programming (8)
- # datomic (9)
- # deps-new (17)
- # eastwood (4)
- # emacs (20)
- # fulcro (18)
- # funcool (1)
- # graalvm (8)
- # leiningen (12)
- # lsp (34)
- # malli (25)
- # meander (4)
- # membrane (4)
- # off-topic (153)
- # practicalli (1)
- # releases (2)
- # remote-jobs (3)
- # rewrite-clj (77)
- # ring (5)
- # shadow-cljs (108)
- # spacemacs (12)
- # tools-deps (9)
- # vscode (11)
- # xtdb (4)
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?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 😅
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, @U11BV7MTK 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? @U11BV7MTK 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
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 ?
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"]]}
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.
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
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) 😄


@U9A1RLFNV LMK if need any help setting up that new action on Calva, it will need to code something for that work
@U0BUV7XSA this action uses a lsp-mode feature called action-handler, it's used on lsp-java, rust and other LSP, it's useful to when you need user input before applying the action, But yeah, the editor needs to handle that as well
@UJCC6CE9E yes, probably @U11EL3P9U will release it tomorrow