This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-23
Channels
- # babashka (22)
- # beginners (8)
- # calva (7)
- # clj-kondo (65)
- # cljdoc (9)
- # cljsrn (1)
- # clojure (53)
- # clojure-australia (4)
- # clojure-europe (49)
- # clojure-gamedev (2)
- # clojure-italy (13)
- # clojure-nl (1)
- # clojure-spec (19)
- # clojure-uk (4)
- # clojurescript (48)
- # clojureverse-ops (1)
- # core-async (3)
- # css (2)
- # cursive (15)
- # datomic (6)
- # degree9 (2)
- # depstar (4)
- # emacs (2)
- # find-my-lib (1)
- # fulcro (16)
- # graalvm (11)
- # gratitude (1)
- # honeysql (9)
- # introduce-yourself (2)
- # jobs (1)
- # joker (2)
- # livestream (2)
- # malli (16)
- # nbb (4)
- # news-and-articles (2)
- # off-topic (1)
- # pathom (7)
- # polylith (10)
- # practicalli (1)
- # re-frame (7)
- # reitit (1)
- # releases (3)
- # remote-jobs (1)
- # rewrite-clj (19)
- # shadow-cljs (10)
- # tools-build (1)
- # tools-deps (9)
- # uncomplicate (1)
- # vim (3)
- # xtdb (44)
this is foolish of me but i’ve forgotten and can’t seem to make it work: how do i disable the :refer :all
lint for clojure.test
and then stop marking deftest
and is
as unresolved symbols?
if it matters, i’m using the #lsp clj-kondo integration instead of relying on clj-kondo directly
clj-kondo --lint "$(clojure -Spath)" --dependencies --parallel --copy-configs
doesn’t make them go away
@nbtheduke This should work:
(ns foo
{:clj-kondo/config '{:linters {:refer-all {:exclude [clojure.test]}}}}
(:require [clojure.test :refer :all]))
(deftest foobar
(is (= 1 2)))
i’m not sure what I’m doing wrong, then, thanks
i’ll keep poking at it
this is a completely fresh, untouched library template from #deps-new, created with clojure -Tnew lib :name io.github.noahtheduke/datalog
i can open a new github repo with this but i’ve not actually written any code yet lol
clojure -Ttools install com.github.seancorfield/deps-new '{:git/tag "v0.1.0" :git/sha "089d868"}' :as new
@nbtheduke From a clean slate:
[email protected] /tmp/datalog $ clj-kondo --lint "$(clojure -Spath)" --dependencies --parallel --copy-configs
[email protected] /tmp/datalog $ clj-kondo --lint test
test/noahtheduke/datalog_test.clj:2:34: warning: use alias or :refer [deftest is testing]
test/noahtheduke/datalog_test.clj:3:41: warning: use alias or :refer
Hmmmmm I don’t know what I broke but I must have broken something. Thanks for verifying.
Perhaps @ericdallo knows more
ah yes, I can reproduce when I'm using the lsp linting instead of directly clj-kondo
Some users already complained about this, and I never manage to reproduce successfully, not sure if it's something with clj-kondo cache or a source-path wrongly configured 😕
it started working for me when I:
1) created a .lsp
folder in the root of the project
2) removed the /tmp/ folder from the workspace (apparently it added that instead of the proper root)
3) deleted .clj-kondo/.cache
4) restarted the workspace
5) imported it from the proper root
1. clojure-lsp always create a .lsp folder after a success analyze, no need to create it
so the project was not analyzed properly by clojure-lsp, the logs or the log to client should say that
could you confirm your project root is configured properly @nbtheduke?
if clojure-lsp doesn't scan the project properly, it will both log to clojure-lsp log and send a message to client which will print something like Classpath lookup failed....
"workspaceFolders": [
{
"uri": "file:///Users/noah/Personal/datalog/test/noahtheduke",
"name": "/Users/noah/Personal/datalog/test"
},
{
"uri": "file:///Users/noah/Personal/datalog/src/noahtheduke",
"name": "/Users/noah/Personal/datalog/src"
},
{
"uri": "file:///Users/noah/Personal/datalog",
"name": "/Users/noah/Personal"
},
{
"uri": "file:///Users/noah/.vim",
"name": "/Users/noah"
}
],
that’s what vim sent to clojure-lsp
hmm, lsp log:
2021-08-23T16:03:49.865Z UnknownHost INFO [clojure-lsp.source-paths:134] - Automatically resolved source-paths from deps.edn: #{"src" "resources" "test"}
2021-08-23T16:03:50.339Z UnknownHost INFO [clojure-lsp.crawler:133] - Analyzing source paths for project root /Users/noah/Personal/datalog
2021-08-23T16:03:50.346Z UnknownHost INFO [clojure-lsp.crawler:77] - Paths analyzed, took 0.006113346 secs. Caching for next startups...
2021-08-23T16:03:50.346Z UnknownHost DEBUG [clojure-lsp.server:?] - :initialize 500ms
2021-08-23T16:03:50.347Z UnknownHost INFO [clojure-lsp.kondo:64] - Linting whole project files took 1ms
2021-08-23T16:03:50.356Z UnknownHost INFO [clojure-lsp.server:350] - Initialized!
2021-08-23T16:03:50.356Z UnknownHost DEBUG [clojure-lsp.server:?] - :initialized 0ms
2021-08-23T16:03:50.361Z UnknownHost DEBUG [clojure-lsp.server:?] - :didOpen 4ms
2021-08-23T16:03:52.362Z UnknownHost DEBUG [clojure-lsp.server:?] - :semanticTokensFull 1ms
2021-08-23T16:03:55.146Z UnknownHost ERROR [clojure-lsp.server:?] -
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine PosixJavaThreads.java: 192
com.oracle.svm.core.thread.JavaThreads.threadStartRoutine JavaThreads.java: 553
java.util.concurrent.ForkJoinWorkerThread.run ForkJoinWorkerThread.java: 183
java.util.concurrent.ForkJoinPool.runWorker ForkJoinPool.java: 1594
java.util.concurrent.ForkJoinPool.scan ForkJoinPool.java: 1656
java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec ForkJoinPool.java: 1020
java.util.concurrent.ForkJoinTask.doExec ForkJoinTask.java: 290
java.util.concurrent.CompletableFuture$AsyncSupply.exec CompletableFuture.java: 1692
java.util.concurrent.CompletableFuture$AsyncSupply.run CompletableFuture.java: 1700
clojure-lsp.server.LSPTextDocumentService/reify/get server.clj: 139
clojure-lsp.handlers/did-close handlers.clj: 69
clojure-lsp.feature.file-management/did-close file_management.clj: 180
clojure-lsp.shared/uri->filename shared.clj: 123
clojure.string/starts-with? string.clj: 364
java.lang.NullPointerException:
2021-08-23T16:03:55.148Z UnknownHost DEBUG [clojure-lsp.server:?] - :didClose 1ms
2021-08-23T16:03:55.216Z UnknownHost DEBUG [clojure-lsp.server:?] - :didOpen 2ms
2021-08-23T16:03:57.220Z UnknownHost DEBUG [clojure-lsp.server:?] - :semanticTokensFull 0ms
is there another way to determine the project root for lsp?
clojure/serverInfo/log
https://clojure-lsp.github.io/clojure-lsp/capabilities/#custom-methods
:project-root-uri "file:///Users/noah/Personal/datalog"
that’s where the deps.edn is, yeah.
yes, one sec
oops, did both and it seems to have resolved itself
very strange
clojure-lsp call clj-kondo 3 (independent from errors) times:
1. during init, after get the project classpath, to get external analysis (jars), calling clj-kondo passing the whole classpath (excluding project source-paths)
2. during init, after 1., to analyze only project source-paths
3. after any file change, running for a single file, but not important for this isue
What I suspect is that, 1. doesn't run properly, but 2. runs fine, persisting a .clj-kondo/cache
with only cache for project, not containing external deps
well, if you have only 2, then the above issue shouldn't have happened, since clj-kondo already has a built-in cache for clojure.test
but if 1 lints clojure.test not correctly then there will be some invalid cache analysis fo clojure.test, which is more likely to cause the issue
yeah, I think it's related with old cache or something like that if you manage to repro again, let us know @nbtheduke
it would have been interesting indeed to inspect the contents of .clj-kondo/.cache after this happened
I’ll keep an eye out and if I see it again, I’ll post it!