Closed rmbxz closed 4 years ago
Yes, the implementation is wrong - it tries to retrieve the actions from all of the language servers in the workspace folder.
Something like that might work.
(defun lsp-treemacs-quick-fix ()
"Select the element under cursor."
(interactive)
(let ((key (button-get (treemacs-node-at-point) :data)))
(if (and (consp key) (lsp-diagnostic-p (cdr key)))
(-let (((file . diag) key)
(session (lsp-session)))
(with-current-buffer (find-file-noselect file)
(with-lsp-workspaces (lsp--try-project-root-workspaces nil nil)
(save-excursion
(goto-char (point-min))
(forward-line (lsp-diagnostic-line diag))
(lsp-execute-code-action-by-kind "quickfix")))))
(user-error "Not no a diagnostic"))))
You are hitting actually 2 bugs - one is the fact that quick fix is executed against the wrong server and the other one is that if you call a method against more than one server and one of them fails and the other succeed lsp-mode never returns.
The bug is fixed! Thank you
M-x lsp-treemacs-quick-fix hangs in session have jdtls with xmlls or html-ls servers
LSP Error List buffer
lspWorkspace 3/1/1 /home/myLSP WelcomeUserAction.java 3/1/1 web3/src/com/mkyong/user/action/ [Java] Java: The value of the field WelcomeUserAction.usernamex is not used (9:16) [Java] Java: username cannot be resolved to a variable (12:9) [Java] Java: username cannot be resolved or is not a field (16:7) [Java] Java: username cannot be resolved (21:6) [Java] Java: TODO Auto-generated method stub (30:5)
M-x lsp-treemacs-quick-fix will hang if I have multi servers in session like html-ls or xmlls with jdtls
the result of lsp-log buffer is Nov 23, 2019 04:53:01 org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError() Message: Internal error: java.lang.NullPointerException java.util.concurrent.CompletionException: java.lang.NullPointerException at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645) at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Caused by: java.lang.NullPointerException at org.eclipse.lsp4xml.commons.LanguageModelCache.get(LanguageModelCache.java:56) at org.eclipse.lsp4xml.XMLTextDocumentService.getXMLDocument(XMLTextDocumentService.java:182) at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$14(XMLTextDocumentService.java:338) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642) ... 6 more
============================== M-x lsp-describe-session the result is
[-] /home/myLSP/lspWorkspace |-[-] html-ls:16446 | |-[-] Buffers | | |-[+] welcome_user.jsp | | |-[+] login.jsp | |
-[+] error.jsp |
-[+] Capabilities |-[-] xmlls:16409 | |-[-] Buffers | | |-[+] struts.xml | | |-[+] web.xml | |-[+] pom.xml |
-[+] Capabilities-[-] jdtls:16368 |-[-] Buffers |
-[+] WelcomeUserAction.java `-[+] Capabilitiesthe temp solution is to kill xmlls and html-ls buffers or kill the processes 16446 0.0 1.1 16:04 00:01 node /usr/local/bin/html-languageserver --stdio 16409 0.4 1.3 16:04 00:11 /usr/bin/java -jar /rmbxz/.emacs.d/lsp4xml/org.eclipse.lsp4xml-0.3.0-uber.jar
==============================