Fork me on GitHub

I'm trying to use the "Resolve macro as" code action by clicking the lightbulb. I choose to resolve as defn, and getting an error "No macro was found at cursor to resolve as 'clojure.core/defn'.". The macro is definintely there as I'm using the context lightbulb action, and it happens on mac and ubuntu. What should I look for to troubleshoot this?


Let's see if @U9A1RLFNV has some idea about what to do here. Might be a bug we need to fix.


I just tried this out and sometimes it worked, sometimes it didn’t. I’m not sure what could be causing it to not work, aside from stale clojure-lsp analysis data. CC @UKFSJSM38


For example, after it didn’t work, I edited the file to cause clojure-lsp to re-analyze the file, and then it worked, but I can’t say that consistently made it work after not working.


In a file with this code in it, the command always worked on the first deftest , but sometimes failed on the second.

(ns core-test
  (:require [clojure.test :refer [is deftest]]))

(deftest test-1
  (is true))

(deftest test-2
  (is (= 1 1)))


that's weird :thinking_face:


I noticed that if I put the cursor after the t in deftest the command always fails, but if I put it before the t, the command always succeeds.


I included logs from successful and unsuccessful runs in the issue.


I need to work now, but I can check back later.


hum, probably we could do a smart resolve macro on clojure-lsp side


it's probably using the exactly symbol at point


thanks for the help


I commented on the issue that Calva could send a selection for what it thinks is the relevant symbol. Then it would correspond to Calva user expectations.


Yeah, but that should be handled by server IMO, we already do that for most refactorings, probably there is room to improvement on clojure-lsp side if that's the issue indeed


Yeah, it does seem like deftest is a reasonable symbol to use for both those cases. Regardless of editor.

Josip Gracin16:08:48

Hi guys, I think PR might resolve this issue.

🙏 2
🎉 2