This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-04
Channels
- # admin-announcements (1)
- # adventofcode (98)
- # announcements (5)
- # asami (3)
- # babashka (24)
- # beginners (51)
- # bitcoin (3)
- # calva (24)
- # clj-kondo (73)
- # cljdoc (5)
- # cljs-dev (2)
- # clojure (15)
- # clojure-czech (3)
- # clojure-dev (27)
- # clojure-europe (7)
- # clojure-gamedev (1)
- # clojure-italy (2)
- # clojure-uk (1)
- # conjure (4)
- # cursive (18)
- # datahike (4)
- # datomic (3)
- # deps-new (7)
- # emacs (1)
- # events (10)
- # fulcro (5)
- # honeysql (4)
- # jackdaw (2)
- # java (13)
- # lsp (85)
- # meander (9)
- # membrane (1)
- # minecraft (1)
- # off-topic (45)
- # re-frame (16)
- # sql (17)
- # tools-deps (10)
- # vscode (9)
- # xtdb (8)
(ns toy.m1)
::x <-lsp-find-all-references => none | expected 1 (below)
::x
With something this new (lsp) i'm not sure if the it's a missing feature, or the idea is a bad one? (maybe only symbols and not keywords are considered.. refs)?
i'm currently on spacemacs. How would i debug this? Whats specific to spacemacs that would change the behavior?
i'm flippying around editors a lot right now to see whats working for me or not 🙂
everything requires some fiddling.
So, I suggest use the function of lsp-mode, as on spaceemacs or doom-emacs they should behave the same
lsp-mode was enabled so same result
you mentioned above you were using lsp-find-all-references
I don't know if that is something specific from spaceemacs, but I suggest using lsp-find-references
I mispoke i was using the fn you suggest
Alright, so this command, lsp-find-references
works for other things? like find function refences and etc?
putting my lsp info here for clean up
clojure-lsp 2021.12.01-12.28.16
clj-kondo 2021.10.20-SNAPSHOT
LSP :: lsp-mode 20211201.1200, Emacs 27.2,
> Alright, so this command, `lsp-find-references` works for other things? like find function refences and etc?
correct, most of the time.
that's odd, it should work for the code:
(ns foo)
::bar
::bar
:foo/bar
find references on any of these keywords should workSo i need to go look at how spacames and doom are setup then, as thats the best way i have to describe the difference.
FWIW here is my output lsp-doctor
Checking for Native JSON support: OK
Check emacs supports `read-process-output-max': OK
Check `read-process-output-max' default has been changed from 4k: OK
Byte compiled against Native JSON (recompile lsp-mode if failing when Native JSON available): OK
`gc-cons-threshold' increased?: OK
Using gccemacs with emacs lisp native compilation (): NOT AVAILABLE (OPTIONAL)
[Trace - 01:22:12 PM] Received response 'textDocument/references - (232)' in 2ms.
Result: []
[Trace - 01:22:12 PM] Sending request 'textDocument/codeAction - (233)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"range": {
"start": {
"line": 2,
"character": 3
},
"end": {
"line": 2,
"character": 3
}
},
"context": {
"diagnostics": []
}
}
is the start and end wrong?
sure it's hard to tell when it stops and starts ill try to clear it
did a full restart on emacs then lsp on, then lsp-find-references
[Trace - 01:26:44 PM] Sending request 'textDocument/codeAction - (24)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"range": {
"start": {
"line": 2,
"character": 3
},
"end": {
"line": 2,
"character": 3
}
},
"context": {
"diagnostics": []
}
}
[Trace - 01:26:44 PM] Sending request 'textDocument/documentHighlight - (25)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"position": {
"line": 2,
"character": 3
}
}
[Trace - 01:26:44 PM] Received response 'textDocument/codeAction - (24)' in 30ms.
Result: [
{
"data": {
"character": 3,
"line": 2,
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs",
"id": "clean-ns"
},
"kind": "source.organizeImports",
"title": "Clean namespace"
}
]
[Trace - 01:26:44 PM] Received response 'textDocument/documentHighlight - (25)' in 30ms.
Result: []
[Trace - 01:26:55 PM] Sending request 'textDocument/codeAction - (26)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 5
}
},
"context": {
"diagnostics": []
}
}
[Trace - 01:26:55 PM] Sending request 'textDocument/documentHighlight - (27)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"position": {
"line": 2,
"character": 4
}
}
[Trace - 01:26:55 PM] Received response 'textDocument/codeAction - (26)' in 31ms.
Result: [
{
"data": {
"character": 4,
"line": 2,
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs",
"id": "clean-ns"
},
"kind": "source.organizeImports",
"title": "Clean namespace"
}
]
[Trace - 01:26:55 PM] Received response 'textDocument/documentHighlight - (27)' in 31ms.
Result: []
[Trace - 01:26:57 PM] Sending request 'textDocument/references - (28)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"position": {
"line": 2,
"character": 4
},
"context": {
"includeDeclaration": false
}
}
[Trace - 01:26:57 PM] Received response 'textDocument/references - (28)' in 5ms.
Result: []
[Trace - 01:26:58 PM] Sending request 'textDocument/codeAction - (29)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 5
}
},
"context": {
"diagnostics": []
}
}
[Trace - 01:26:58 PM] Sending request 'textDocument/documentHighlight - (30)'.
Params: {
"textDocument": {
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs"
},
"position": {
"line": 2,
"character": 4
}
}
[Trace - 01:26:58 PM] Received response 'textDocument/codeAction - (29)' in 29ms.
Result: [
{
"data": {
"character": 4,
"line": 2,
"uri": "file:///home/drewverlee/Personal/toy/src/main/toy/m1.cljs",
"id": "clean-ns"
},
"kind": "source.organizeImports",
"title": "Clean namespace"
}
]
[Trace - 01:26:58 PM] Received response 'textDocument/documentHighlight - (30)' in 29ms.
Result: []
would have sent less, no idea what to edit out
There is something really weird with your lsp, even code actions are returning only clean ns instead of a lot of other code actions
LSP :: {:final-settings
{:source-aliases #{:test :dev},
:uri-format
{:upper-case-drive-letter? false, :encode-colons-in-path? false},
:cljfmt-config-path ".cljfmt.edn",
:document-formatting? true,
:source-paths
["/home/drewverlee/Personal/src" "/home/drewverlee/Personal/test"],
:text-document-sync-kind nil,
:project-specs
({:project-path "project.clj", :classpath-cmd ["lein" "classpath"]}
{:project-path "deps.edn",
:classpath-cmd ["clojure" "-A:dev:test" "-Spath"]}
{:project-path "build.boot",
:classpath-cmd ["boot" "show" "--fake-classpath"]}
{:project-path "shadow-cljs.edn",
:classpath-cmd ["npx" "shadow-cljs" "classpath"]}
{:project-path "bb.edn",
:classpath-cmd ["bb" "print-deps" "--format" "classpath"]}),
:dependency-scheme "jar",
:show-docs-arity-on-same-line? true,
:document-range-formatting? true,
:cljfmt {:indents {}}},
:client-settings
{:source-aliases nil,
:cljfmt-config-path ".cljfmt.edn",
:document-formatting? true,
:source-paths nil,
:text-document-sync-kind nil,
:project-specs nil,
:dependency-scheme "jar",
:show-docs-arity-on-same-line? true,
:document-range-formatting? true,
:cljfmt {:indents {}}},
:project-root-uri "file:///home/drewverlee/Personal",
:port "NREPL only available on :debug profile (`make debug-bin`)",
:project-settings {},
:server-version "2021.12.01-12.28.16",
:clj-kondo-version "2021.10.20-SNAPSHOT",
:log-path "/tmp/clojure-lsp.127230218534107860.out",
:classpath-settings nil}
Could you get clojure-lsp server log and check if there is anything incorrect there like exceptions?
I would have expected source path to be /personal/toy/.. something /personal is a directory back from the cljs project root
If i change the workspace via workspace-add, to the path i suggested then it finds both keywords (from example earlier) as references. awesome. So i think something is intalizing the lsp folder wrong. Or it makes some assumption i dont
like, its picking a directory back then i wanted and thats probably loading it more then i want or it can handle? idk.
to be clear, something auto starts LSP for me when i went into the folder. It picked one level back in /personal (from my example) not /personal/toy which seems to work.
You chose the wrong project root probably some time ago the first time you opened the project
thats what i mean, i just hit enter when it said "do you want to add workspace" I wouldn't assumed it knew or it would have asked me in a more... direct way.
it was very confident lol
but i have to test it. maybe i told it wrong at one point
it "feels" like i was able to reproduce the above issue. If i make the root workspace to far back it has trouble finding refs. In this other case, the root folder is a company wide one so finding qualified keys across it is useful.
But obviously there is a limit as to how far we can search!
Yeah, I heavily recommend to use the root of the project that has the deps.edn or project.clj as some clojure-lsp features may not work if using an incorrect root
Does it care if there are multiple deps? Thats a very common and useful thing to have is cross project shared keywords.
great, thats what i would have expected.
more to the point it would be great if you could find all the keywords noramlized between fully qualified and aliased.
:toy.m1/x <-lsp-find-all-references => none | expected 1 (below)
::x
K. Then like i said in my othe rcomment, its a spacemacs (or my config setup)
clojure-lsp 2021.12.01-12.28.16 clj-kondo 2021.10.20-SNAPSHOT
Don’t know if it’s mentioned (or done) but it would be really nice to have some way of jumping to implementations of both protocol fns and multimethods:
(defprotocol IFoo
(foo [bar])) ;; <- click on this and get a list of places which have an implementation of `foo` for `IFoo`
;; also
(foo bar) <- click on this and get a list of possible impls, not only go to the protocol def
yeah, This is something I thought about implementing but it was not as priority as other issues, but it makes sense I think
Not sure if clj-kondo provides all the analysis necessary for this, I'm pretty sure it doesn't.
I basically winged extend-type, extend-protocol etc since the start of clj-kondo until a few days ago
But those expand currently not into something which let you trace this back. It's been on my mind as well, but will take more time
Hum, good to know @U04V15CAJ I was not sure as well but I was about to take a look
@UKFSJSM38 feel free to take a look
If I find any thing to be improved on kondo, I start with a issue so we can debug it better
my lsp-session is all red dots in the tree (see pic) i would expect it to be different colorsl like here https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/#log-client-server-json. I also would expect those colors to mean their typically counterparts. Like red is a problem. If so, what, what problem?
I don't remember exactly what the colors mean, I can check it later ( not on PC right now)
brb, and thanks.