Closed lassemaatta closed 1 year ago
@ericdallo willing to take a look?
I can't repro that, maybe it could be something that only happens on emacs master? @lassemaatta could you:
textDocument/definition
enabling lsp-log-io
and running lsp-workspace-show-log
That would help understand better, we need to understand why lsp--locations-to-xref-items
is returning nil, but for that we need to know what server is returning
Sure, I'll test another version of emacs and check the logs tomorrow 👍
I doubt it is from the emacs version. It is something between the client and the server.
@ericdallo: I did a quick test (trying to find the definition of mount.core/start
) without switching my emacs version:
[Trace - 05:03:02 pm] Sending request 'textDocument/definition - (35)'.
Params: {
"textDocument": {
"uri": "file:///home/lassemaatta/work/lupapiste/stest/lupapalvelu/proxy_services_stest.clj"
},
"position": {
"line": 21,
"character": 1
}
}
[Trace - 05:03:02 pm] Received response 'textDocument/definition - (35)' in 2ms.
Result: {
"uri": "zipfile:///home/lassemaatta/.m2/repository/mount/mount/0.1.16/mount-0.1.16.jar::mount/core.cljc",
"range": {
"start": {
"line": 280,
"character": 6
},
"end": {
"line": 280,
"character": 11
}
}
}
Nothing else appears in the *lsp-log: clojure-lsp:<port>*
log/buffer after that.
And just for comparison; running the same for a project-local symbol (which works fine):
[Trace - 05:08:57 pm] Sending request 'textDocument/definition - (38)'.
Params: {
"textDocument": {
"uri": "file:///home/lassemaatta/work/lupapiste/stest/lupapalvelu/proxy_services_stest.clj"
},
"position": {
"line": 19,
"character": 1
}
}
[Trace - 05:08:57 pm] Received response 'textDocument/definition - (38)' in 2ms.
Result: {
"uri": "file:///home/lassemaatta/work/lupapiste/test-utils/lupapalvelu/itest_util.clj",
"range": {
"start": {
"line": 201,
"character": 5
},
"end": {
"line": 201,
"character": 14
}
}
}
Perhaps there's something funky going on with that zipfile URL.
Oh yeah, that zip file doesn't work for emacs, the initializationOption dependecy-scheme
should be jar for emacs, that's weird though since we always set that on lsp-clojure.el
Could you paste the output of lsp-clojure-server-info
?
Sure. Here's a somewhat cleaned up version without the classpath jars etc.
{: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 ["a bunch of source paths omitted"],
:text-document-sync-kind nil,
:project-specs ({:project-path "project.clj",
:classpath-cmd ["/usr/bin/lein" "with-profile" "+test,+dev" "classpath"]}
{:project-path "deps.edn",
:classpath-cmd ["/usr/bin/clojure" "-A:test:dev" "-Spath"]}
{:project-path "build.boot",
:classpath-cmd ["boot" "show" "--fake-classpath"]}
{:project-path "shadow-cljs.edn",
:classpath-cmd ["/usr/local/bin/npx" "shadow-cljs" "classpath"]}
{:project-path "bb.edn",
:classpath-cmd ["/usr/bin/bb" "print-deps" "--format" "classpath"]}),
:dependency-scheme "jar",
:linters {:unused-public-var {:level :off}},
:lint-project-files-after-startup? true,
:show-docs-arity-on-same-line? true,
:document-range-formatting? true,
:clean {:ns-inner-blocks-indentation :same-line,
:sort {:ns true, :require true, :import true, :refer true}}},
:classpath #{"omitted a billion jars and a few directories.."},
:cljfmt-raw "{}",
:client-settings {:dependency-scheme "jar",
:show-docs-arity-on-same-line? true,
:text-document-sync-kind nil,
:source-paths nil,
:source-aliases nil,
:cljfmt-config-path ".cljfmt.edn",
:document-formatting? true,
:document-range-formatting? true},
:project-root-uri "file:///home/lassemaatta/work/lupapiste",
:port "NREPL only available on :debug profile (`bb debug-cli`)",
:project-settings {:source-paths #{"a bunch of source paths"},
:show-docs-arity-on-same-line? true,
:lint-project-files-after-startup? true,
:linters {:unused-public-var {:level :off}},
:clean {:ns-inner-blocks-indentation :same-line,
:sort {:ns true, :require true, :import true, :refer true}}},
:server-version "2022.12.09-15.51.10",
:clj-kondo-version "2022.12.08",
:log-path "/tmp/clojure-lsp.12885567199498124818.out",
:classpath-settings nil}
I guess the relevant part is the :dependency-scheme "jar"
@lassemaatta can you upgrade your clojurelsp?
that looks updated an correct, we can see there is a :dependency-scheme
"jar"
which is the correct, I wonder why clojure-lsp is retuning zipfile
.
Anyway, looks like a server bug, we can close this and create a issue on clojure-lsp, it'd be nice to confirm if that happens in small simple repros as well @lassemaatta, I usually use clojure-sample to test some things
Sounds good. I'll try to find the time to dig deeper, try to isolate the problem, and then open a ticket for clojure-lsp
with details. It looks like this problem is somehow project-specific; I have a couple of large projects where (as far as I know) only one of them exhibits this problem.
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
lsp-find-definition
throws an error (see attached stack trace).Also happens with
M-x lsp-start-plain
.This primarily seems to happen when applying
lsp-find-definition
to functions defined in external libraries. Navigating to functions defined in the project seems to work.Steps to reproduce
lsp-find-definition
Expected behavior
Navigating to functions with
lsp-find-definition
should not throw an error.Which Language Server did you use?
clojure-lsp
OS
Linux
Error callstack
Anything else?
Running
GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6) of 2023-01-24
andLSP :: lsp-mode 20230124.1058, Emacs 30.0.50, gnu/linux
.