ITADN

lsp java: Command java.completion.onDidSelect not supported by the server

#498Closedsincebyte 创建于 2025-09-13
S
sincebytecommented
**Describe the bug** In doomemacs,I use lsp-mode lsp-java. - It seems when lsp completion exit,there have a lsp error only in java lsp mode, python do not have this issue. - use company and corfu the issue exist either. - i rollback lsp mode's commit the issue exist either. https://github.com/emacs-lsp/lsp-mode/issues/4875 ``` error("Timeout while waiting for response. Method: %s" "workspace/executeCommand") lsp-request("workspace/executeCommand" (:command "java.completion.onDidSelect" :arguments ["5" "0"])) lsp-workspace-command-execute("java.completion.onDidSelect" ["5" "0"]) lsp-send-execute-command("java.completion.onDidSelect" ["5" "0"]) lsp--execute-command((:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"])) lsp-completion--exit-fn(#("res" 0 3 (lsp-completion-prefix "res" lsp-completion-markers (1663 #<marker (moves after insertion) at 1666 in LoginController.java>) lsp-completion-start-point 1663 lsp-sort-text "999999097" lsp-completion-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663) lsp-completion-unresolved-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663))) finished #f(compiled-function () #<bytecode 0x15a29d721f99cd89>)) apply(lsp-completion--exit-fn (#("res" 0 3 (lsp-completion-prefix "res" lsp-completion-markers (1663 #<marker (moves after insertion) at 1666 in LoginController.java>) lsp-completion-start-point 1663 lsp-sort-text "999999097" lsp-completion-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663) lsp-completion-unresolved-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663))) finished #f(compiled-function () #<bytecode 0x15a29d721f99cd89>))) #f(compiled-function (&rest args-before) #<bytecode -0x2e636bdd2f30fcf>)(#("res" 0 3 (lsp-completion-prefix "res" lsp-completion-markers (1663 #<marker (moves after insertion) at 1666 in LoginController.java>) lsp-completion-start-point 1663 lsp-sort-text "999999097" lsp-completion-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663) lsp-completion-unresolved-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663))) finished) corfu--exit-function(#("res" 0 3 (lsp-completion-prefix "res" lsp-completion-markers (1663 #<marker (moves after insertion) at 1666 in LoginController.java>) lsp-completion-start-point 1663 lsp-sort-text "999999097" lsp-completion-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663) lsp-completion-unresolved-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663))) finished nil) corfu--done(#("res" 0 3 (lsp-completion-prefix "res" lsp-completion-markers (1663 #<marker (moves after insertion) at 1666 in LoginController.java>) lsp-completion-start-point 1663 lsp-sort-text "999999097" lsp-completion-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663) lsp-completion-unresolved-item (:label "res" :labelDetails (:description "String") :kind 6 :sortText "999999097" :filterText #("res" 0 3 (match-data (0 3 0 1 1 2 2 3))) :insertText "res" :insertTextFormat 2 :insertTextMode 2 :textEdit (:newText "res" :insert (:start (:line 46 :character 8) :end (:line 46 :character 11)) :replace (:start (:line 46 :character 8) :end (:line 46 :character 11))) :command (:title "" :command "java.completion.onDidSelect" :arguments ["5" "0"]) :data (:pid "0" :rid "5") :_emacsStartPoint 1663))) finished nil) #f(compiled-function (status) #<bytecode 0x14890603f8bb4268>)(finished) apply(#f(compiled-function (status) #<bytecode 0x14890603f8bb4268>) finished) #f(compiled-function (&rest args) #<bytecode 0x1f3f383c0b7a7f1f>)(finished) apply(#f(compiled-function (&rest args) #<bytecode 0x1f3f383c0b7a7f1f>) finished) #f(compiled-function (&rest args) #<bytecode -0x15d40804c7b40147>)() #f(compiled-function (cl--cnm status) #<bytecode -0x12319b5b60dbb339>)(#f(compiled-function (&rest args) #<bytecode -0x15d40804c7b40147>) finished) apply(#f(compiled-function (cl--cnm status) #<bytecode -0x12319b5b60dbb339>) #f(compiled-function (&rest args) #<bytecode -0x15d40804c7b40147>) finished) #f(compiled-function (status) #<bytecode -0x141dc90263699f9>)(finished) apply(#f(compiled-function (status) #<bytecode -0x141dc90263699f9>) finished) corfu--insert(finished) corfu-insert() funcall-interactively(corfu-insert) ``` **Note** Before logging the bug please make sure that the issue is reproducible with latest melpa packages and it is reproducible with the clean config(the config from the getting started page. **To Reproduce** 1. install doom emacs 2. config init.el ``` elisp :tools ;;ansible ;;biblio ; Writes a PhD for you (citation needed) ;;collab ; buffers with friends ;;debugger ; FIXME stepping through code, to help you add bugs ;;direnv ;;docker ;;editorconfig ; let someone else argue about tabs vs spaces ;;ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) lookup ; navigate your code and its documentation ;;llm ; when I said you needed friends, I didn't mean... lsp ; M-x vscode magit ; a git porcelain for Emacs ;;make ; run make tasks from Emacs ;;pass ; password manager for nerds ;;pdf ; pdf enhancements ;;terraform ; infrastructure as code ;;tmux ; an API for interacting with tmux tree-sitter ; syntax and parsing, sitting in a tree... ;;upload ; map local to remote projects via ssh/ftp :lang (java +lsp +tree-sitter) ; the poster child for carpal tunnel syndrome ``` 3. open a java file in a maven project 4. install tree-sitter lib , install jdtls 5. make some change in the code , such as complete a code segment. 6. then the error occurred. **Expected behavior** complete without block emacs **Screenshots** [If applicable, add screenshots to help explain your problem. ](https://github.com/user-attachments/assets/831f32b1-f21c-4325-8584-301366a88766) **Logs** ``` [Trace - 11:01:35 AM] Sending notification 'textDocument/didChange'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "version": 23 }, "contentChanges": [ { "range": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } }, "rangeLength": 0, "text": "debug" } ] } [Trace - 11:01:35 AM] Sending notification 'textDocument/didChange'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "version": 24 }, "contentChanges": [ { "range": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 15 } }, "rangeLength": 5, "text": "" } ] } [Trace - 11:01:35 AM] Sending notification 'textDocument/didChange'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "version": 25 }, "contentChanges": [ { "range": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } }, "rangeLength": 0, "text": "debug(${1:channelId});" } ] } [Trace - 11:01:35 AM] Sending notification 'textDocument/didChange'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "version": 26 }, "contentChanges": [ { "range": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 32 } }, "rangeLength": 22, "text": "" } ] } [Trace - 11:01:35 AM] Sending notification 'textDocument/didChange'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "version": 27 }, "contentChanges": [ { "range": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } }, "rangeLength": 0, "text": "debug(channelId);" } ] } [Trace - 11:01:35 AM] Sending request 'completionItem/resolve - (71)'. Params: { "label": "debug", "labelDetails": { "detail": "(String msg)", "description": "void" }, "kind": 2, "detail": "Logger.debug(String msg) : void", "sortText": "999999035", "filterText": "debug(String msg) : void", "insertText": "debug", "insertTextFormat": 2, "insertTextMode": 2, "textEdit": { "newText": "debug(${1:channelId});", "insert": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } }, "replace": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } } }, "command": { "title": "", "command": "java.completion.onDidSelect", "arguments": [ "7", "0" ] }, "data": { "pid": "0", "rid": "7" } } [Trace - 11:01:35 AM] Sending request 'workspace/executeCommand - (72)'. Params: { "command": "java.completion.onDidSelect", "arguments": [ "7", "0" ] } [Trace - 11:01:35 AM] Received notification 'language/progressReport'. Params: { "id": "aa0c720c-fee9-442d-acc1-47b83e0f62dd", "task": "Validate documents", "status": "0% ", "totalWork": 1000, "workDone": 0, "complete": null } [Trace - 11:01:35 AM] Received notification 'window/logMessage'. Params: { "type": 3, "message": "2025年9月11日 11:01:35 Reconciled 1. Took 3 ms" } [Trace - 11:01:35 AM] Received notification 'language/progressReport'. Params: { "id": "aa0c720c-fee9-442d-acc1-47b83e0f62dd", "task": "Validate documents", "status": "0% ", "totalWork": 1000, "workDone": 0, "complete": true } [Trace - 11:01:35 AM] Received response 'completionItem/resolve - (71)' in 6ms. Result: { "label": "debug", "labelDetails": { "detail": "(String msg)", "description": "void" }, "kind": 2, "detail": "Logger.debug(String msg) : void", "documentation": { "kind": "markdown", "value": "Log a message at the DEBUG level.\n\n * **Parameters:**\n \n * **msg** the message string to be logged" }, "sortText": "999999035", "filterText": "debug(String msg) : void", "insertText": "debug", "insertTextFormat": 2, "insertTextMode": 2, "textEdit": { "newText": "debug(${1:channelId});", "insert": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } }, "replace": { "start": { "line": 266, "character": 10 }, "end": { "line": 266, "character": 10 } } }, "command": { "title": "", "command": "java.completion.onDidSelect", "arguments": [ "7", "0" ] } } [Trace - 11:01:35 AM] Received response 'workspace/executeCommand - (72)' in 6ms. Result: null [Trace - 11:01:35 AM] Received notification 'language/progressReport'. Params: { "id": "80c6789d-4978-4abd-ab65-66c127c4f2b3", "task": "Publish Diagnostics", "status": "0% ", "totalWork": 1000, "workDone": 0, "complete": null } [Trace - 11:01:35 AM] Received notification 'window/logMessage'. Params: { "type": 3, "message": "2025年9月11日 11:01:35 begin problem for /PlayController.java" } [Trace - 11:01:35 AM] Received notification 'window/logMessage'. Params: { "type": 3, "message": "2025年9月11日 11:01:35 3 problems reported for /PlayController.java" } [Trace - 11:01:35 AM] Received notification 'textDocument/publishDiagnostics'. Params: { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java", "diagnostics": [ { "range": { "start": { "line": 21, "character": 7 }, "end": { "line": 21, "character": 43 } }, "severity": 2, "code": "268435844", "source": "Java", "message": "The import com.genersoft.iot.vmp.utils.DateUtil is never used", "tags": [ 1 ] }, { "range": { "start": { "line": 56, "character": 22 }, "end": { "line": 56, "character": 27 } }, "severity": 2, "code": "570425421", "source": "Java", "message": "The value of the field PlayController.cmder is not used", "tags": [ 1 ] }, { "range": { "start": { "line": 125, "character": 19 }, "end": { "line": 125, "character": 22 } }, "severity": 2, "code": "134217861", "source": "Java", "message": "The constructor URL(String) is deprecated", "tags": [ 2 ] } ] } [Trace - 11:01:35 AM] Received notification 'window/logMessage'. Params: { "type": 3, "message": "2025年9月11日 11:01:35 Validated 1. Took 44 ms" } [Trace - 11:01:35 AM] Received notification 'language/progressReport'. Params: { "id": "80c6789d-4978-4abd-ab65-66c127c4f2b3", "task": "Publish Diagnostics", "status": "50% ", "totalWork": 1000, "workDone": 500, "complete": true } [Trace - 11:01:45 AM] Sending request 'textDocument/documentHighlight - (73)'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" }, "position": { "line": 266, "character": 16 } } [Trace - 11:01:45 AM] Sending request 'textDocument/codeLens - (74)'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" } } [Trace - 11:01:45 AM] Received response 'textDocument/codeLens - (74)' in 5ms. Result: [] [Trace - 11:01:45 AM] Received response 'textDocument/documentHighlight - (73)' in 29ms. Result: [ { "range": { "start": { "line": 264, "character": 63 }, "end": { "line": 264, "character": 72 } }, "kind": 3 }, { "range": { "start": { "line": 266, "character": 16 }, "end": { "line": 266, "character": 25 } }, "kind": 2 }, { "range": { "start": { "line": 267, "character": 41 }, "end": { "line": 267, "character": 50 } }, "kind": 2 }, { "range": { "start": { "line": 280, "character": 37 }, "end": { "line": 280, "character": 46 } }, "kind": 2 }, { "range": { "start": { "line": 281, "character": 32 }, "end": { "line": 281, "character": 41 } }, "kind": 2 } ] [Trace - 11:01:46 AM] Sending request 'textDocument/hover - (75)'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" }, "position": { "line": 266, "character": 16 } } [Trace - 11:01:46 AM] Received response 'textDocument/hover - (75)' in 30ms. Result: { "contents": { "language": "java", "value": "String channelId - com.genersoft.iot.vmp.vmanager.gb28181.play.PlayController.getSnap(String, String, boolean)" } } [Trace - 11:01:50 AM] Sending request 'textDocument/hover - (76)'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" }, "position": { "line": 266, "character": 16 } } [Trace - 11:01:50 AM] Received response 'textDocument/hover - (76)' in 20ms. Result: { "contents": { "language": "java", "value": "String channelId - com.genersoft.iot.vmp.vmanager.gb28181.play.PlayController.getSnap(String, String, boolean)" } } [Trace - 11:01:54 AM] Sending notification 'textDocument/willSave'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" }, "reason": 2 } [Trace - 11:02:39 AM] Sending notification 'textDocument/willSave'. Params: { "textDocument": { "uri": "file:///Users/van/ZY/workspace/wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java" }, "reason": 2 } ```
关闭于 2025-09-15 1 条评论