Fork me on GitHub
#lsp
<
2022-05-06
>
Erick Isos14:05:28

Hey folks, como vai? Quick question: I recently ran clojure-lsp diagnostics on one personal project and discovered that it fails on (deftest named-test …) saying that named-test is an unresolved symbol. Is there a way to avoid that? I thought that the name of the test can be anything that I want 😢

ericdallo14:05:50

it can be whatever name, pretty weird error, some double checks to do: • what's your clojure-lsp --version? • the same happens if you rm .clj-kondo/.cache ? if so try removing .lsp/.cache as well

ericdallo15:05:02

also, could you paste the code snippet?

Erick Isos05:05:39

Thanks Eric, as always. You should be able to access to https://github.com/erickisos/audiotools/runs/6324675108?check_suite_focus=true, however I attached a screenshot with the exact same problem on local. The Github Action has this version (clojure-lsp-version: 2022.05.03-12.35.40)

ericdallo13:05:19

I see, it seems to me that the reason is that you are using deftest from schema.test, not clojure.test

ericdallo13:05:51

If that was really intended, you will need to instruct clj-kondo to lint that deftest macro as a clojure.test/deftest

💜 1
Erick Isos13:05:37

Oh man, thanks, that was the problem

ericdallo13:05:23

Something like this should work: .clj-kondo/config.edn

{:lint-as {schema.test/deftest clojure.test/deftest}}

ericdallo13:05:56

BTW this could be fixed on schema lib itself, exporting that config which clojure-lsp would copy automtically

jacob.maine19:05:39

@snoe, having the clojure-lsp.debug namespace available was super helpful while https://github.com/clojure-lsp/clojure-lsp/issues/970#issuecomment-1119259297 a performance problem in clojure.core. Thanks for the the encouragement to get that https://github.com/clojure-lsp/clojure-lsp/pull/944. I have one other annoyance about using the nREPL—the test namespaces aren’t on the source paths / classpath, so you can’t easily run the tests as you change the implementation. To get around this I usually resort to switching back and forth between the clojure-lsp repl and a regular CIDER repl, which really breaks the flow. Actually, it is possible to run the tests from the clojure-lsp nREPL, but you have to open clojure-lsp.test-helper and cider-eval-buffer first. That works because CIDER doesn’t care that clojure-lsp.test-helper isn’t on the classpath. Then you can use the same trick to evaluate a test buffer, and then you can run tests. @ericdallo I assume this could be fixed either by including more aliases in the build and/or by changing around the various deps.edn configurations. You have a much better sense of how that stuff fits together. Do you think it’s possible?

🙏 1
jacob.maine19:05:16

Or maybe by adding an additional path to the src-dirs in the build? It’s all still sort of black magic to me.

ericdallo22:05:33

Yeah, possible, I think we can include the test path on the debug profile, no problem I think

👍 1
snoe22:05:59

if you're not building graal, you can add aliases together when you launch

👍 1
ericdallo21:05:03

Forgot to mention this is already available, you can now connect to a running process repl and eval tests normally

jacob.maine04:06:03

I noticed when it was added and played with it briefly, I was able to run tests, which was nice, but then everything froze and I had to restart the editor. I’ll plan to experiment with it more sometime

👍 1
ericdallo13:06:58

I noticed some freezing as well, but didn't find or managed to repro again