Closed crimsonhawk47 closed 1 year ago
Has clojure-lsp started correctly?
Has clojure-lsp started correctly?
Yes
What do you get in the clojure-lsp server log? Also see if the message trace log. You can reach the server log via the clojure-lsp status bar button, and from there also find the trace log settings.
Clojure-lsp log
2022-11-20T20:58:18.659Z INFO [clojure-lsp.handlers:253] - :document-highlight 0ms
2022-11-20T20:58:18.661Z INFO [clojure-lsp.handlers:410] - :code-actions 2ms
2022-11-20T20:58:18.875Z INFO [clojure-lsp.handlers:410] - :code-actions 2ms
2022-11-20T20:58:21.424Z INFO [clojure-lsp.handlers:209] - :prepare-rename 0ms
2022-11-20T20:58:22.381Z INFO [clojure-lsp.handlers:216] - :rename 0ms
Verbose log
2022-11-20T21:28:05.981Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:05.980Z] Received request 'textDocument/hover - (5565)'
Params: {
"text-document" : {
"uri" : "{path}/state.cljs"
},
"position" : {
"line" : 27,
"character" : 19
}
}
2022-11-20T21:28:05.985Z INFO [clojure-lsp.handlers:374] - :hover 4ms
2022-11-20T21:28:05.985Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:05.985Z] Sending response 'textDocument/hover - (5565)'. Request took 5ms.
Result: {
"range" : {
"start" : {
"line" : 27,
"character" : 6
},
"end" : {
"line" : 27,
"character" : 22
}
},
"contents" : {
"kind" : "markdown",
"value" : "```clojure\nkit.guestbook.features.player-sheet.state/submit-character\n[reconciler controller-name effect]\n```\n\n----\n\n*[{path}state.cljs](file:///{path}state.cljs)*"
}
}
2022-11-20T21:28:06.974Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:06.974Z] Received request 'textDocument/prepareRename - (5566)'
Params: {
"text-document" : {
"uri" : "file:///{path}state.cljs"
},
"position" : {
"line" : 28,
"character" : 20
}
}
2022-11-20T21:28:06.974Z INFO [clojure-lsp.handlers:209] - :prepare-rename 0ms
2022-11-20T21:28:06.975Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:06.975Z] Sending response 'textDocument/prepareRename - (5566)'. Request took 1ms.
Result: {
"start" : {
"line" : 28,
"character" : 16
},
"end" : {
"line" : 28,
"character" : 20
}
}
2022-11-20T21:28:07.885Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:07.885Z] Received request 'textDocument/rename - (5567)'
Params: {
"text-document" : {
"uri" : "file:///{path}state.cljs"
},
"position" : {
"line" : 28,
"character" : 20
},
"new-name" : "data2"
}
2022-11-20T21:28:07.885Z INFO [clojure-lsp.handlers:216] - :rename 0ms
2022-11-20T21:28:07.886Z DEBUG [clojure-lsp.server:55] - [Trace - 2022-11-20T21:28:07.886Z] Sending response 'textDocument/rename - (5567)'. Request took 1ms. Request failed: Can't rename, no element found. (-32602).
Error data: null
Does this happen only in a specific project or any project? CC @ericdallo
No, it happens on any project. A fresh lein app project as well
I have also deleted the global lsp cache and project lsp cache
It could be that the VS Code install has issues. Can you try with VS Code Insiders and see if the problem is there too?
This is the check clojure-lsp does to allow renaming and the message usually is pretty clear (LMK if there is anything to improve), but from the message "Can't rename, no element found."
, usually means you are trying to rename something that there is no clj-kondo analysis for, something that is not renamable, like a string "foo"
.
To debug this we need to know if clojure-lsp started and analyzed your project properly, so paste the full server log here
This is happening on two different windows computers, btw
This is the check clojure-lsp does to allow renaming and the message usually is pretty clear (LMK if there is anything to improve), but from the message
"Can't rename, no element found."
, usually means you are trying to rename something that there is no clj-kondo analysis for, something that is not renamable, like a string"foo"
.To debug this we need to know if clojure-lsp started and analyzed your project properly, so paste the full server log here
These are logs/server info for a fresh lein app.
Logs:
2022-11-22T06:13:32.365Z INFO [clojure-lsp.server:599] - [SERVER] Starting server...
2022-11-22T06:13:32.368Z DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2022-11-22T06:13:32.369Z INFO [clojure-lsp.server:485] - Initializing...
2022-11-22T06:13:32.397Z INFO [clojure-lsp.db:66] - [DB] Reading transit analysis cache from C:\Users\Gabriel\Documents\Programming\personal\rename-test\.lsp\.cache\db.transit.json db took 27ms
2022-11-22T06:13:32.416Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 18ms
2022-11-22T06:13:33.412Z INFO [clojure-lsp.startup:205] - [Startup] Using cached db for project root C:\Users\Gabriel\Documents\Programming\personal\rename-test
2022-11-22T06:13:33.415Z INFO [clojure-lsp.source-paths:85] - [Startup] Using source-paths from classpath: ["C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\src" "C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\dev-resources" "C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\test"]
2022-11-22T06:13:33.415Z INFO [clojure-lsp.startup:113] - Copying kondo configs from classpath to project if any...
2022-11-22T06:13:33.438Z WARN [clojure-lsp.kondo:303] - Non-fatal error from clj-kondo: No configs copied.
2022-11-22T06:13:33.438Z INFO [clojure-lsp.startup:115] - Copied kondo configs, took 23ms secs.
2022-11-22T06:13:33.439Z INFO [clojure-lsp.startup:237] - [Startup] Analyzing source paths for project root C:\Users\Gabriel\Documents\Programming\personal\rename-test
2022-11-22T06:13:33.439Z INFO [clojure-lsp.startup:74] - [Startup] Project only paths analyzed by clj-depend, took 1ms
2022-11-22T06:13:33.448Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2022-11-22T06:13:33.449Z INFO [clojure-lsp.kondo:210] - Linting whole project for unused-public-var took 1ms
2022-11-22T06:13:33.450Z WARN [clojure-lsp.kondo:303] - Non-fatal error from clj-kondo: No configs copied.
2022-11-22T06:13:33.450Z INFO [clojure-lsp.startup:70] - [Startup] Project only paths analyzed by clj-kondo, took 11ms
2022-11-22T06:13:33.450Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2022-11-22T06:13:33.452Z INFO [clojure-lsp.handlers:150] - [Startup] Analyzing test paths for project root file:///c:/Users/Gabriel/Documents/Programming/personal/rename-test
2022-11-22T06:13:33.452Z INFO [clojure-lsp.feature.clojuredocs:21] - [Clojuredocs] Refreshing clojuredocs cache...
2022-11-22T06:13:33.452Z INFO [clojure-lsp.handlers:128] - :initialize 1083ms
2022-11-22T06:13:33.452Z INFO [clojure-lsp.server:102] - :publish-diagnostics 0ms
2022-11-22T06:13:33.452Z INFO [clojure-lsp.feature.java-interop:270] - [Java] JDK source already present on global LSP cache dir.
2022-11-22T06:13:33.452Z INFO [clojure-lsp.server:164] - :refreshing-test-tree 0ms
2022-11-22T06:13:33.453Z INFO [clojure-lsp.server:102] - :publish-diagnostics 0ms
2022-11-22T06:13:33.455Z INFO [clojure-lsp.server:507] - Initialized!
2022-11-22T06:13:33.469Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2022-11-22T06:13:33.470Z WARN [clojure-lsp.kondo:303] - Non-fatal error from clj-kondo: No configs copied.
2022-11-22T06:13:33.470Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2022-11-22T06:13:33.471Z INFO [clojure-lsp.handlers:158] - :did-open 7ms
2022-11-22T06:13:33.471Z INFO [clojure-lsp.server:164] - :refreshing-test-tree 0ms
2022-11-22T06:13:33.471Z WARN [clojure-lsp.server:403] - {:settings {}}
2022-11-22T06:13:33.486Z INFO [clojure-lsp.handlers:246] - :document-symbol 0ms
2022-11-22T06:13:33.487Z INFO [clojure-lsp.handlers:410] - :code-actions 1ms
2022-11-22T06:13:33.527Z INFO [clojure-lsp.db:66] - [DB] Reading transit analysis cache from C:\Users\Gabriel\.cache\clojure-lsp\db.transit.json db took 73ms
2022-11-22T06:13:33.527Z INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2022-11-22T06:13:33.528Z INFO [clojure-lsp.feature.java-interop:304] - [Java] JDK source cached loaded successfully.
2022-11-22T06:13:33.579Z INFO [clojure-lsp.server:102] - :publish-diagnostics 0ms
2022-11-22T06:13:33.864Z INFO [clojure-lsp.handlers:410] - :code-actions 1ms
2022-11-22T06:13:33.970Z INFO [clojure-lsp.handlers:443] - :semantic-tokens-range 0ms
2022-11-22T06:13:34.365Z INFO [clojure-lsp.feature.clojuredocs:23] - [Clojuredocs] Refreshing clojuredocs cache took 913ms.
2022-11-22T06:13:34.672Z INFO [clojure-lsp.handlers:435] - :semantic-tokens-full 0ms
Server info:
Welcome to Calva. Happy Clojure and ClojureScript coding! ❤️
Please check these resources out:
Calva Documentation: https://calva.io/
#calva at the Clojurians Slack: https://clojurians.slack.com/messages/calva/
Bug reports: https://github.com/BetterThanTomorrow/calva/issues
If you like Calva, please consider how you can contribute: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Contribute
Calva is utilizing cider-nrepl and clojure-lsp to create this VS Code experience.
nREPL dependencies configured:
nrepl: 1.0.0
cider-nrepl: 0.28.5
cider/piggieback: 0.5.3
clojure-lsp version configured: latest
If you are new to Calva, please see: https://calva.io/getting-started/
And please consider the command: **Calva: Fire up the Getting Started REPL**
Calva version used: v2.0.319
clojure-lsp version used: 2022.11.03-00.14.57
clj-kondo version used: 2022.11.02
Clojure-lsp server info:
{
"log-path": "C:\\Users\\Gabriel\\AppData\\Local\\Temp\\clojure-lsp.10989240431222773662.out",
"project-settings": {},
"classpath": [
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\src",
"C:\\Users\\Gabriel\\.m2\\repository\\org\\clojure\\core.specs.alpha\\0.2.56\\core.specs.alpha-0.2.56.jar",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\target\\default+test\\classes",
"C:\\Users\\Gabriel\\.m2\\repository\\org\\clojure\\spec.alpha\\0.2.194\\spec.alpha-0.2.194.jar",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\dev-resources",
"C:\\Users\\Gabriel\\.m2\\repository\\org\\clojure\\clojure\\1.10.3\\clojure-1.10.3.jar",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\test",
"C:\\Users\\Gabriel\\.m2\\repository\\org\\nrepl\\incomplete\\0.1.0\\incomplete-0.1.0.jar",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\resources",
"C:\\Users\\Gabriel\\.m2\\repository\\nrepl\\nrepl\\0.8.3\\nrepl-0.8.3.jar"
],
"project-root-uri": "file:///c:/Users/Gabriel/Documents/Programming/personal/rename-test",
"client-settings": {
"auto-add-ns-to-new-files?": true,
"document-formatting?": false,
"dependency-scheme": "jar",
"keep-require-at-start?": true,
"source-paths": null,
"text-document-sync-kind": null,
"source-aliases": null,
"document-range-formatting?": false,
"cljfmt-config-path": ".cljfmt.edn"
},
"clj-kondo-version": "2022.11.02",
"server-version": "2022.11.03-00.14.57",
"port": "NREPL only available on :debug profile (`bb debug-cli`)",
"final-settings": {
"auto-add-ns-to-new-files?": true,
"document-formatting?": false,
"dependency-scheme": "jar",
"keep-require-at-start?": true,
"source-paths": [
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\src",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\dev-resources",
"C:\\Users\\Gabriel\\Documents\\Programming\\personal\\rename-test\\test"
],
"project-specs": [
{
"project-path": "project.clj",
"classpath-cmd": [
"C:\\Users\\Gabriel\\.lein\\bin\\lein.bat",
"with-profile",
"+test,+dev",
"classpath"
]
},
{
"project-path": "deps.edn",
"classpath-cmd": [
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"-NoProfile",
"-Command",
"clojure",
"-A:test:dev",
"-Spath"
]
},
{
"project-path": "build.boot",
"classpath-cmd": [
"boot",
"show",
"--fake-classpath"
]
},
{
"project-path": "shadow-cljs.edn",
"classpath-cmd": [
"C:\\Users\\Gabriel\\scoop\\apps\\nodejs\\current\\npx.cmd",
"shadow-cljs",
"classpath"
]
},
{
"project-path": "bb.edn",
"classpath-cmd": [
"bb",
"print-deps",
"--format",
"classpath"
]
}
],
"text-document-sync-kind": null,
"source-aliases": [
"test",
"dev"
],
"uri-format": {
"upper-case-drive-letter?": false,
"encode-colons-in-path?": false
},
"document-range-formatting?": false,
"cljfmt-config-path": ".cljfmt.edn"
},
"classpath-settings": null,
"cljfmt-raw": "{}"
}
@crimsonhawk47 do you remember roughly when it used to work? Could be a change in Calva that trips it up. So you could try with an earlier version. Please see the Changelog for matching versions against dates.
@crimsonhawk47 do you remember roughly when it used to work? Could be a change in Calva that trips it up. So you could try with an earlier version. Please see the Changelog for matching versions against dates.
@PEZ I did some testing as far back as 2.0.273 and have not been able to rename anything.
Again, happening on two different windows computers
Thanks, @crimsonhawk47! Have you tried with different versions of clojure-lsp?
also, is there a sample project?
Thanks, @crimsonhawk47! Have you tried with different versions of clojure-lsp?
It looks like the previous version of clojure-lsp makes this functionality work again.
That is, 2022.10.05-16.39.51 works and 2022.11.03-00.14.57 does not
Let's keep this issue open for discoverability.
@crimsonhawk47 I can recommend giving it a go to fix the issue (without knowing anything about how tricky it might be). It is great fun. Here's a video on the subject: https://www.youtube.com/watch?v=4UvT0yqBDw8
This should be fixed on clojure-lsp master
Hurray! Thanks @ericdallo!
Does fixed on master mean it can be tested with the nightly
clojure-lsp setting in Calva?
Yes @PEZ
Going to close this since it's merged to master and the upstream issue is closed now. @crimsonhawk47 If you still have the issue with the nightly clojure-lsp build let us know. You can use the nightly build with Calva with this setting + value:
"calva.clojureLspVersion": "nightly"
This has happened out of nowhere, even if I restart my computer, and it's pretty egregious. I can't rename any symbol names. We're talking functions as simple as this.
Can't rename val
Deleted .lsp and .clj-kondo in my project directory