Fork me on GitHub
#lsp
<
2022-11-03
>
ericdallo11:11:19

clojure-lsp Released clojure-lsp https://github.com/clojure-lsp/clojure-lsp/releases/tag/2022.11.03-00.14.57 with performance improvements and more! 🚀 • General ◦ Bump clj-kondo to 2022.11.02 avoiding breaking changes on custom hooks. ◦ Bump graalvm to 22.3.0. https://github.com/clojure-lsp/clojure-lsp/issues/1345 • Editor ◦ Add refactorings to change param order of defn/`defmacro`, also changing call sites. https://github.com/clojure-lsp/clojure-lsp/issues/1131 ◦ Avoid shadowing existing locals when restructuring keys. https://github.com/clojure-lsp/clojure-lsp/issues/1229 ◦ Let editors control whether the server's log includes traces of the messages they are exchanging. https://github.com/clojure-lsp/lsp4clj/issues/27 ◦ Bump promesa to 9.0.470 ◦ Bump lsp4clj to 1.5.0 ◦ For users with fewer cores, avoid unnecessary waits for file analysis. ◦ Reduce CPU usage by aborting requests that the client won't use. ◦ Fix to mark some code actions as preferred, so editors can emphasize them. https://github.com/clojure-lsp/lsp4clj/issues/32 ◦ Adds java classes completions, since clj-kondo now knows all java classes defined on external dependencies. https://github.com/clojure-lsp/clojure-lsp/issues/1329 ◦ Fix completion to consider required namespaces without alias or refers. https://github.com/clojure-lsp/clojure-lsp/issues/1352 Most important changes were related to improvements on lsp4clj side regarding cancelling requests that client doesn't care anymore. We also have a new refactoring to swap param order of functions! 🎉 Happy coding! 👋

🎉 15
clojure-lsp 7
clj-kondo 4
Dumch17:11:03

I wrote a custom clj-kondo.hook for a macro, and now I can't use go-to-definition on it (it just move cursor at the beginning of the line). Just to give a few details: Imagine macro is called macro-name. My hook:

(defn my-hook-fn [{:keys [node]}]
  ...
  {:node (with-meta 
           (list-node (list (-> node :children first) (do ...)))
           (meta node))
sexpr of this node that is returning from my-hook-fn is: (macro-name (do ...)) How do I debug it? Maybe someone had this problem already? 🙏:skin-tone-2: P.S. defn block inside this do was the problem. I had to wrap it with meta

✔️ 1
Dumch17:11:54

Latest LSP, 2022.11.03-00.14.57

ericdallo17:11:43

So your macro defines a var-definition right? that's why you want to go to the definition

ericdallo17:11:27

I think you need to add a (def aanywhere in your code, @U04V15CAJ may know more about it

Dumch17:11:49

No, I am not defining this macro-name. I am rewriting node only to have this do block inside. The macro-name is used like (macro-name {...}) And I am rewriting it to be like (macro-name (do ...)) This macro is defined in a ns called macros . And I want to go here with gd.

Dumch17:11:19

Without the custom hook go-to-definition works.

ericdallo17:11:10

I see, I think your (meta node) is wrong, you should use the meta of the first children I guess

ericdallo17:11:22

not sure though, @U04V15CAJ may know better

ericdallo17:11:41

A sample repo may help understand the issue too

Dumch17:11:17

Hmm, I think your first idea was right... I should rewrite this node to be a definition. P.S. No, I don't want it to be a new defn thing, I just want go-to-definition work on this.

Dumch18:11:36

I found the cause of this problem. I was adding a "defn" node inside this "do" block. To fix the problem, I wrapped defn-node in its own meta, and that fixed the problem.

Dumch18:11:46

thank you for helping

borkdude18:11:25

@UL05W6AEM You can debug using println and then call the linter from the command line

Dumch18:11:57

Yes, I was doing it

Dumch18:11:23

wow! didn't know about that, thank youP