Fork me on GitHub
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 😢


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


also, could you paste the code snippet?

Erick Isos05:05:39

Thanks Eric, as always. You should be able to access to, 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)


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


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


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

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


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


@snoe, having the clojure-lsp.debug namespace available was super helpful while a performance problem in clojure.core. Thanks for the the encouragement to get that 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

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


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

👍 1

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

👍 1

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


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

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