Hey @borkdude about the unresolved-other-ns
feature on latest clj-kondo, I'm testing it with clojure-lsp
and it seems is not working properly
The warning will only show if the ns was analyzed
@snoe any clue why this happen?
@ericdallo you can check .clj-kondo/.cache/<your-version>/clj/rewrite-clj/...
to see if clj-kondo in fact analyzed this jar
(please note that this data is implementation detail and should not be used by other tools)
Odd, it was analyzed indeed:
wait, the rewrite-clj.zip
is not in there
I will try locally. Which version of rewrite-clj is this?
rewrite-clj/rewrite-clj {:local/root "lib/rewrite-clj-0.6.2-SNAPSHOT.jar"}
We can replace the local jar with the clojars released recently
oh, maybe this could be the issue? the jar is on clojure-lsp/lib
, so clj-kondo is not scanning it propertly
when I do this:
clj-kondo --lint $(clojure -Spath -Sdeps '{:deps {rewrite-clj/rewrite-clj {:mvn/version "RELEASE"}}}')
I do get the correct ones.if you lint the deps using your deps.edn using -Spath
clj-kondo should be able to find it
yeah, probably if we use the jar from clojars like the others may work
yeah the issue is that the lib
folder is not in the clojure-lsp classpath to scan
I'll try changing it to use the rewrite-clj from clojars
Btw, if you provide the option :no-warnings
then clj-kondo will cache jars and won't lint them again (when the same option is used again)
There is also :parallel true
for faster linting
oh, that certainly will be useful
this is only useful when using a classpath, as it only lints jars in parallel
yes, I'll test it setting that to true on classpath scans
Hum, using the jar from maven did not work, still I can't find the rewrite-clj.zip
and rewrite-clj.node
analysis on .clj-kondo/.cache
folder
I can't repro this using clj-kondo only π€·
if you can make a command line clj-kondo repro, I will look into it
the paralell option seems to have a huge startup improvement for clojure-lsp π thank you! I'll try to reproduce the issue with rewrite-clj with kondo only, (I don't have clj-kondo installed yet since I have NixOS and is not updated with your last release yet π )
@ericdallo You can also use it from the JVM with clojure -Sdeps
or lein or whatever :)
oh, right, so I can lein run or something like that?
Yeah, you can follow this README: https://github.com/clj-kondo/clj-kondo/blob/master/doc/jvm.md
clj -Sdeps '{:deps {clj-kondo {:mvn/version "RELEASE"}}}' -m clj-kondo.main --lint $(clojure -Spath)
Thanks, I managed to run now, I ran this way:
clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.01.20"}}}' -m clj-kondo.main --lint $(clojure -Spath -Sdeps '{:deps {rewrite-clj/rewrite-clj {:mvn/version "0.6.1"}}}')
should work
It seems that indeed linted rewrite-clj.zip
, I cannot find on .clj-kondo/.cache
though
Hmm, indeed:
borkdude@MBP2019 /tmp/foobar $ clojure -Sdeps '{:deps {clj-kondo {:mvn/version "2021.01.20"}}}' -m clj-kondo.main --no-warnings --lint $(clojure -Spath -Sdeps '{:deps {rewrite-clj/rewrite-clj {:mvn/version "RELEASE"}}}')
WARNING: When invoking clojure.main, use -M
borkdude@MBP2019 /tmp/foobar $ find . | grep rewrite-clj.zip
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.seq.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.walk.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.move.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.whitespace.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.insert.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.subedit.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.find.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.base.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.edit.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.transit.json
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.remove.transit.json
I'll take a look
thank you π !
Oh, it is there after all:
./.clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.transit.json
$ cat .clj-kondo/.cache/2021.01.20/clj/rewrite-clj.zip.transit.json | jet --from transit | puget
{->root-string {:col 1,
:deprecated "0.4.0",
:fixed-arities #{1},
:name ->root-string,
:ns rewrite-clj.zip,
:row 116,
:top-ns rewrite-clj.zip},
->string {:col 1,
:deprecated "0.4.0",
:fixed-arities #{1},
:name ->string,
:ns rewrite-clj.zip,
:row 111,
:top-ns rewrite-clj.zip},
defbase {:col 1,
:fixed-arities #{2},
:macro true,
:name defbase,
:ns rewrite-clj.zip,
:private true,
:row 83,
:top-ns rewrite-clj.zip}}
so all seems good on the clj-kondo side
Yeah, I found it, I'll look closely again via clojure-lsp if it's missing or not
I could reproduce the issue with other lib matcher-combinators
and I could find indeed the cache transit: .clj-kondo/.cache/2021.01.20/clj/matcher-combinators.midje.transit.json
clojure-lsp just use the findings to produce those diagnostics, there is no parsing
@borkdude it seems the transit does not contain some methods, for example, I could reproduce again with digest
lib on clojure-lsp
and when I :
cat .clj-kondo/.cache/2021.01.20/clj/digest.transit.json | lein jet --from transit --to json |jq .
it returns:
{
"create-fn!": {
"row": 83,
"col": 1,
"fixed-arities": [
1
],
"name": "create-fn!",
"ns": "digest",
"top-ns": "digest"
},
"Digestible": {
"row": 35,
"col": 1,
"name": "Digestible",
"ns": "digest",
"top-ns": "digest"
},
"create-fns": {
"row": 94,
"col": 1,
"private": true,
"fixed-arities": [
0
],
"name": "create-fns",
"ns": "digest",
"top-ns": "digest"
},
"-digest": {
"row": 35,
"col": 1,
"fixed-arities": [
2
],
"name": "-digest",
"ns": "digest",
"top-ns": "digest"
},
"signature": {
"row": 27,
"col": 1,
"private": true,
"fixed-arities": [
1
],
"name": "signature",
"ns": "digest",
"top-ns": "digest",
"arities": {
"1": {
"ret": "string"
}
}
},
"digest": {
"row": 70,
"col": 1,
"fixed-arities": [
2
],
"name": "digest",
"ns": "digest",
"top-ns": "digest"
},
"byte-seq": {
"row": 22,
"col": 1,
"private": true,
"fixed-arities": [
1
],
"name": "byte-seq",
"ns": "digest",
"top-ns": "digest",
"arities": {
"1": {
"ret": "seq"
}
}
},
"read-some": {
"row": 13,
"col": 1,
"private": true,
"fixed-arities": [
1
],
"name": "read-some",
"ns": "digest",
"top-ns": "digest"
},
"algorithms": {
"row": 75,
"col": 1,
"fixed-arities": [
0
],
"name": "algorithms",
"ns": "digest",
"top-ns": "digest",
"arities": {
"0": {
"ret": "set"
}
}
},
"*buffer-size*": {
"row": 11,
"col": 1,
"name": "*buffer-size*",
"ns": "digest",
"top-ns": "digest"
}
}
it seems it's missing some functions like md5
which clojure-lsp uses:and how is this digest function defined?
the same is happening with rewrite-clj.zip:
it's just a required lib: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L15
this is ours deps.edn: https://github.com/clojure-lsp/clojure-lsp/blob/master/deps.edn#L17
Please make a small repro, isolated from any other tools (not depending on LSP for example), just using deps.edn and clj-kondo JVM. Then I'll look into it tomorrow It's past midnight here.
File it as an issue on the clj-kondo github if you can make a repro.
sure, thanks π
good night π
Thanks π€
It seems to report unused var from external deps
I could only reproduce with rewrite-clj.zip`` and
rewrite-clj.node
for some reason :thinking_face:
Hum, I think clj-kondo is not scanning rewrite-clj
jar correcly, what is causing that, maybe we should not show the lint if the analysis was not done properly?
Also, I'm not sure how can I check if rewrite-clj
was analyzed properly, I can only say it does not shows up on clj-kondo analysis output
clojure-lsp
doesn't seem to be parsing my cljs
code. I'd really appreciate jump-to and find-references support for cljs
ootb. Is this supported? Perhaps it's something I've misconfigured my end?
> source-paths
Β value is a set of project-local directories to look for clj/cljc/cljs files
Great, looks like it was operator error
If anyone has any input on optimising clojure-lsp
for clj/cljc/cljs
projects I'd appreciate tips/experience reports. I'm hooking into it via lsp-mode
in combination with cider
at the moment.
I'm don't have much experience with cljs, but what kind of issues you have?
When I try to lsp-goto-implementation
(with the clojure-lsp
started) I'm getting:
The connected server(s) does not support method textDocument/implementation.
Here's the output of lsp-describe-session
`-[-] clojure-lsp:56843
|-[-] Buffers
| |-[+] cards.cljc<components>
| |-[+] cards.cljc<specs>
| `-[+] system.clj
`-[-] Capabilities
|-[-] semanticTokensProvider:
| |-[X] full: t
| |-[X] range: t
| `-[-] legend:
| |-[X] tokenModifiers: []
| `-[X] tokenTypes: [type function macro]
|-[X] callHierarchyProvider: t
|-[-] executeCommandProvider:
| `-[X] commands: [add-missing-libspec add-import-to-namespace cycle-privacy thread-last-all unwind-all move-to-let clean-ns thread-last introduce-let unwind-thread thread-first-all thread-first inline-symbol extract-function cycle-coll expand-let]
|-[X] renameProvider: t
|-[X] documentRangeFormattingProvider: t
|-[X] documentFormattingProvider: t
|-[-] codeLensProvider:
| `-[X] resolveProvider: t
|-[X] codeActionProvider: t
|-[X] workspaceSymbolProvider: t
|-[X] documentSymbolProvider: t
|-[X] documentHighlightProvider: t
|-[X] referencesProvider: t
|-[X] definitionProvider: t
|-[-] completionProvider:
| |-[X] triggerCharacters: []
| `-[X] resolveProvider: t
|-[X] hoverProvider: t
`-[-] textDocumentSync:
|-[-] save:
| `-[X] includeText: t
|-[X] change: 1
`-[X] openClose: t
I'm just getting started with lsp
so apologies if there something obviously poorly configured my side.lsp-find-references
on the other hand is now actually working great with cljc
and cljs
π
yeah, clojure-lsp don't have lsp-find-implementation implemented, we just have lsp-find-definition
implementation makes sense to go to interface implementations and etc, it's not really useful for clojure
find-definition on other hand is what makes sense for clojure
lsp-find-definition
should work for you
@codeasone this could help you π https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/