-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Internal Error for "textDocument/codeAction" request #1603
Comments
Could youshare please your XML file? Which vesrion are you isng of vscode-xml? |
Here is my XML Code
I'm not using vscode-xml. We are using our own language client. We just cloned this repository, built it using the steps provided and used the Jar file. Java version |
Ok I understand more. The NPE comes from https://github.com/eclipse/lemminx/blob/def27a72256bd94a57404a58ac219790fe7c831e/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLTextDocumentService.java#L512 and it seems that your LSP client doesn't support the LSP codeActionLiteralSupport and and this case you need to implement a custom LSP command We could fix the NPE but your code actions will not work except if you implement custom LSP command I suggest really that you support codeActionLiteralSupport in your LSP client to follow the LSP specification and yoru code actions will work too with another language server. We did this work when LSP didn't provide codeActionLiteralSupport but I think we should remove the code with @fbricon @datho7561 what do you think about that? |
Thanks @angelozerr It worked after adding codeActionLiteralSupport. |
reopening as Lemminx should be able to gracefully handle clients that don't support codeActionLiteralSupport. |
I'm getting internal error while invoking "textDocument/codeAction" request with the following params:
{ context: { diagnostics: [ { range: { start: { line: 1, character: 1, }, end: { line: 1, character: 6, }, }, message: "No grammar constraints (DTD or XML Schema).", code: "NoGrammarConstraints", severity: 4, source: "xml", }, { range: { start: { line: 1, character: 1, }, end: { line: 1, character: 6, }, }, message: "XML document structures must start and end within the same entity.", code: "MarkupEntityMismatch", severity: 1, source: "xml", }, ], only: [ "quickfix", ], }, range: { start: { line: 1, character: 1, }, end: { line: 1, character: 6, }, }, textDocument: { uri: "file:///home/workspace/XML/test.xml", } }
Here is response stack trace
ResponseError: Internal error. at handleResponse (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:449:48) at processMessageQueue (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:276:17) at Immediate.<anonymous> (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:260:13) at processImmediate (node:internal/timers:466:21) at process.callbackTrampoline (node:internal/async_hooks:130:17) { code: -32603, data: 'java.util.concurrent.CompletionException: java.lang.NullPointerException\n' + '\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)\n' + '\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)\n' + '\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\n' + '\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\n' + 'Caused by: java.lang.NullPointerException\n' + '\tat org.eclipse.lemminx.XMLTextDocumentService.lambda$codeAction$23(XMLTextDocumentService.java:512)\n' + '\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n' + '\tat java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)\n' + '\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)\n' + '\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n' + '\tat java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)\n' + '\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)\n' + '\tat java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)\n' + '\tat org.eclipse.lemminx.XMLTextDocumentService.lambda$codeAction$24(XMLTextDocumentService.java:518)\n' + '\tat org.eclipse.lemminx.commons.ModelTextDocuments.lambda$computeModelAsync$0(ModelTextDocuments.java:118)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\n' + '\t... 6 more\n' } CODE ACTION PARAMS { textDocument: { uri: 'file:///home/workspace/XML/test.xml' }, range: { start: { line: 1, character: 1 }, end: { line: 1, character: 6 } }, context: { diagnostics: [ [Object], [Object] ], only: [ 'quickfix' ] } } LANGUAGE CLIENT ERROR ResponseError: Internal error. at handleResponse (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:449:48) at processMessageQueue (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:276:17) at Immediate.<anonymous> (/home/workspace/CODE_IDE/node_modules/vscode-jsonrpc/lib/main.js:260:13) at processImmediate (node:internal/timers:466:21) at process.callbackTrampoline (node:internal/async_hooks:130:17) { code: -32603, data: 'java.util.concurrent.CompletionException: java.lang.NullPointerException\n' + '\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)\n' + '\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)\n' + '\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\n' + '\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\n' + 'Caused by: java.lang.NullPointerException\n' + '\tat org.eclipse.lemminx.XMLTextDocumentService.lambda$codeAction$23(XMLTextDocumentService.java:512)\n' + '\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n' + '\tat java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)\n' + '\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)\n' + '\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n' + '\tat java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)\n' + '\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)\n' + '\tat java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)\n' + '\tat org.eclipse.lemminx.XMLTextDocumentService.lambda$codeAction$24(XMLTextDocumentService.java:518)\n' + '\tat org.eclipse.lemminx.commons.ModelTextDocuments.lambda$computeModelAsync$0(ModelTextDocuments.java:118)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\n' + '\t... 6 more\n' }
The text was updated successfully, but these errors were encountered: