clojure-lsp / clojure-lsp

Clojure & ClojureScript Language Server (LSP) implementation

Home Page:https://clojure-lsp.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`thread last all` command fails with internal error -32603

fdmarc opened this issue · comments

Describe the bug
When I select Thread last all in Calva, I get an error:

Request workspace/executeCommand failed.
Source: Calca Clojure & ClojureScript Interactive Programming...

To Reproduce

(defn func []
  #_(prn "axes" axes)
  (filter identity (map (partial s/blank?) [])))

Place the cursor on the symbol filter and execute Thread last all.

Expected behavior
I expect to see this code:

(defn func []
  (->> []
       (map (partial s/blank?))
       (filter identity)))

Screenshots

image

image

image

Log - client <-> server
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.404
clojure-lsp version used: 2023.10.30-16.25.41
clj-kondo version used: 2023.10.21-SNAPSHOT
Clojure-lsp server info:
{
"log-path": "/tmp/clojure-lsp.5416287962285430797.out",
"project-settings": {},
"classpath": null,
"project-root-uri": "file:///home/marc/dev/advent-of-code",
"analysis-summary": {
"internal": {
"keyword-usages": 24,
"local-usages": 54,
"namespace-alias": 5,
"namespace-usages": 12,
"var-usages": 178,
"namespace-definitions": 3,
"java-class-usages": 1,
"locals": 36,
"var-definitions": 17
},
"external": {
"instance-invocations": 502,
"protocol-impls": 21,
"local-usages": 7084,
"namespace-alias": 1,
"namespace-usages": 1,
"symbols": 3,
"var-usages": 7733,
"namespace-definitions": 4,
"java-class-usages": 991,
"locals": 3596,
"var-definitions": 812
}
},
"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": "2023.10.21-SNAPSHOT",
"server-version": "2023.10.30-16.25.41",
"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": null,
"project-specs": [
{
"project-path": "project.clj",
"classpath-cmd": [
"lein",
"with-profile",
"+test,+dev",
"classpath"
]
},
{
"project-path": "deps.edn",
"classpath-cmd": [
"clojure",
"-A:test:dev",
"-Spath"
]
},
{
"project-path": "build.boot",
"classpath-cmd": [
"boot",
"show",
"--fake-classpath"
]
},
{
"project-path": "shadow-cljs.edn",
"classpath-cmd": [
"/home/marc/.nvm/versions/node/v20.5.0/bin/npx",
"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": "{}"
}

Log - clojure-lsp
[Trace - 6:32:52 PM] Sending request 'workspace/executeCommand - (4085)'.
Params: {
    "command": "thread-last-all",
    "arguments": [
        "file:///home/marc/dev/advent-of-code/lib.clj",
        7,
        6
    ]
}

[Trace - 6:32:52 PM] Received response 'workspace/executeCommand - (4085)' in 2ms. Request failed: Internal error (-32603).
Error data: {
"id": 4085,
"method": "workspace/executeCommand"
}

[Error - 6:32:52 PM] Request workspace/executeCommand failed.
Message: Internal error
Code: -32603
[object Object]
[Trace - 6:32:52 PM] Sending request 'textDocument/codeAction - (4086)'.
Params: {
"textDocument": {
"uri": "file:///home/marc/dev/advent-of-code/lib.clj"
},
"range": {
"start": {
"line": 7,
"character": 6
},
"end": {
"line": 7,
"character": 6
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}

[Trace - 6:32:52 PM] Received response 'textDocument/codeAction - (4086)' in 2ms.
Result: [
{
"title": "Move to let",
"kind": "refactor.extract",
"command": {
"title": "Move to let",
"command": "move-to-let",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6,
"new-binding"
]
}
},
{
"title": "Cycle privacy",
"kind": "refactor.rewrite",
"command": {
"title": "Cycle privacy",
"command": "cycle-privacy",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
},
{
"title": "Extract function",
"kind": "refactor.extract",
"command": {
"title": "Extract function",
"command": "extract-function",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6,
"new-function"
]
}
},
{
"title": "Extract to def",
"kind": "refactor.extract",
"command": {
"title": "Extract to def",
"command": "extract-to-def",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6,
null
]
}
},
{
"title": "Thread first all",
"kind": "refactor.rewrite",
"command": {
"title": "Thread first all",
"command": "thread-first-all",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
},
{
"title": "Thread last all",
"kind": "refactor.rewrite",
"command": {
"title": "Thread last all",
"command": "thread-last-all",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
},
{
"title": "Sort list",
"kind": "refactor.rewrite",
"command": {
"title": "Sort list",
"command": "sort-clauses",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
},
{
"title": "Drag forward",
"kind": "refactor.rewrite",
"command": {
"title": "Drag forward",
"command": "drag-forward",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
},
{
"title": "Introduce let",
"kind": "refactor.extract",
"command": {
"title": "Introduce let",
"command": "introduce-let",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6,
"new-binding"
]
}
},
{
"title": "Clean namespace",
"kind": "source.organizeImports",
"command": {
"title": "Clean namespace",
"command": "clean-ns",
"arguments": [
"file:///home/marc/dev/advent-of-code/lib.clj",
7,
6
]
}
}
]

User details (please complete the following information):

  • OS: Windows 11 10.0.22631 Build 22631
  • Editor VSCode (Calva)
  • Calva version used: v2.0.404
  • clojure-lsp version used: 2023.10.30-16.25.41
  • clj-kondo version used: 2023.10.21-SNAPSHOT

Additional context
I'm back using Clojure for Advent of Code ❤️

The bug seems to be caused by the #_ form - if I remove that, then the problem doesn't occur.

Thank you! it's related indeed with the way we handle the comment form