eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.
https://eclipse.org/lsp4j
Other
608 stars 144 forks source link

UnsupportedOperationException trying to convert a vscode extension #657

Closed ZeeD closed 2 years ago

ZeeD commented 2 years ago

Hi (sorry if it's not the right place, I hope I got it right)

There is a vscode extension (BrightScript Language) that, among other things, implements an LSP. My understanding is that the main logic is here, so I tough it would be possible to extract as a stand-alone script.

I have written a simple wrapper (basically it's just the following code)

#!/usr/bin/env node

const { LanguageServer } = require('brighterscript');
const server = new LanguageServer();
server.run();

and integrated into eclipse (I'm using WWD, so via gui I created a new launch configuration, and assigned it via Preferences -> "Languages servers"). I can see that the script starts. Unfortunately it seems to crash. The logs (below) seems to indicate that the server requires to the client to do an "workspace/configuration" operation, and the client... doesn't seem to understand.

Is it a "bug" (a missing implementation?) of lsp4j?

[t=1660741653658] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741653658] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"2","method":"shutdown","params":null}

[t=1660741653658] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741653658] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"3","method":"shutdown","params":null}

[t=1660741653659] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741653659] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741653659] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741653659] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741653667] LSP4E to brighterscript-language-server-bin:
Content-Length: 1580

[t=1660741653667] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"processId":3138,"rootPath":"/Users/a206719281/eclipse-workspace/ocellus-src/","rootUri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","delete","rename"],"failureHandling":"undo"},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true},"textDocument":{"synchronization":{"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"completionItem":{"snippetSupport":true,"documentationFormat":["markdown","plaintext"]}},"hover":{"contentFormat":["markdown","plaintext"]},"signatureHelp":{},"references":{},"documentHighlight":{},"documentSymbol":{"symbolKind":{"valueSet":[18,17,5,14,9,10,22,24,8,1,12,11,20,6,2,3,21,16,19,25,4,7,15,23,26,13]},"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{},"definition":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"resolveSupport":{"properties":["edit"]},"dynamicRegistration":true},"codeLens":{},"documentLink":{},"colorProvider":{},"rename":{},"foldingRange":{}}},"clientName":"Eclipse IDE","trace":"off","workspaceFolders":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}}

[t=1660741654105] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":"1","result":{"capabilities":{"textDocumentSync":1,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."],"allCommitCharacters":[".","@"]},"documentSymbolProvider":true,"workspaceSymbolProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"full":true},"referencesProvider":true,"codeActionProvider":{"codeActionKinds":["refactor"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"hoverProvider":true,"executeCommandProvider":{"commands":["TranspileFile"]}}}}

[t=1660741654107] LSP4E to brighterscript-language-server-bin:
Content-Length: 52

[t=1660741654107] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"initialized","params":{}}

[t=1660741654108] LSP4E to brighterscript-language-server-bin:
Content-Length: 744

[t=1660741654108] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/demo/roku-player/src/components/MainScene.bs","languageId":"bs","version":1,"text":"import \"pkg:/source/roku_modules/rodash/rodash.brs\"\n\nsub init()\n    foo \u003d rodash.add(3, 5)\n\n    videocontent \u003d createObject(\"RoSGNode\", \"ContentNode\")\n    videocontent.title \u003d `Example Video: [${foo}]`\n    videocontent.streamformat \u003d \"hls\"\n    videocontent.url \u003d \"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8\"\n    video \u003d m.top.findNode(\"exampleVideo\")\n    video.content \u003d videocontent\n    video.setFocus(true)\n    video.control \u003d \"play\"\nend sub\n"}}}

[t=1660741654112] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":0,"method":"workspace/workspaceFolders"}

[t=1660741654113] LSP4E to brighterscript-language-server-bin:
Content-Length: 122

[t=1660741654113] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":0,"result":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}

[t=1660741654119] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"scopeUri":"/Users/a206719281/eclipse-workspace/ocellus-src/","section":"files"}]}}

[t=1660741654120] LSP4E to brighterscript-language-server-bin:
Content-Length: 1915

[t=1660741654120] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Internal error.","data":"java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)\n\tat org.eclipse.lsp4e.LanguageServerWrapper.lambda$3(LanguageServerWrapper.java:270)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.reflect.InvocationTargetException\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:577)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)\n\t... 12 more\nCaused by: java.lang.UnsupportedOperationException\n\tat org.eclipse.lsp4j.services.LanguageClient.configuration(LanguageClient.java:138)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)\n\t... 14 more\n"}}

[t=1660741654893] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741654893] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"2","method":"shutdown","params":null}

[t=1660741654893] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741654893] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"3","method":"shutdown","params":null}

[t=1660741654894] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741654894] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741654895] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741654895] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741654904] LSP4E to brighterscript-language-server-bin:
Content-Length: 1580

[t=1660741654904] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"processId":3138,"rootPath":"/Users/a206719281/eclipse-workspace/ocellus-src/","rootUri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","delete","rename"],"failureHandling":"undo"},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true},"textDocument":{"synchronization":{"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"completionItem":{"snippetSupport":true,"documentationFormat":["markdown","plaintext"]}},"hover":{"contentFormat":["markdown","plaintext"]},"signatureHelp":{},"references":{},"documentHighlight":{},"documentSymbol":{"symbolKind":{"valueSet":[18,17,5,14,9,10,22,24,8,1,12,11,20,6,2,3,21,16,19,25,4,7,15,23,26,13]},"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{},"definition":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"resolveSupport":{"properties":["edit"]},"dynamicRegistration":true},"codeLens":{},"documentLink":{},"colorProvider":{},"rename":{},"foldingRange":{}}},"clientName":"Eclipse IDE","trace":"off","workspaceFolders":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}}

[t=1660741655321] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":"1","result":{"capabilities":{"textDocumentSync":1,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."],"allCommitCharacters":[".","@"]},"documentSymbolProvider":true,"workspaceSymbolProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"full":true},"referencesProvider":true,"codeActionProvider":{"codeActionKinds":["refactor"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"hoverProvider":true,"executeCommandProvider":{"commands":["TranspileFile"]}}}}

[t=1660741655323] LSP4E to brighterscript-language-server-bin:
Content-Length: 52

[t=1660741655323] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"initialized","params":{}}

[t=1660741655323] LSP4E to brighterscript-language-server-bin:
Content-Length: 744

[t=1660741655323] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/demo/roku-player/src/components/MainScene.bs","languageId":"bs","version":1,"text":"import \"pkg:/source/roku_modules/rodash/rodash.brs\"\n\nsub init()\n    foo \u003d rodash.add(3, 5)\n\n    videocontent \u003d createObject(\"RoSGNode\", \"ContentNode\")\n    videocontent.title \u003d `Example Video: [${foo}]`\n    videocontent.streamformat \u003d \"hls\"\n    videocontent.url \u003d \"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8\"\n    video \u003d m.top.findNode(\"exampleVideo\")\n    video.content \u003d videocontent\n    video.setFocus(true)\n    video.control \u003d \"play\"\nend sub\n"}}}

[t=1660741655324] LSP4E to brighterscript-language-server-bin:
Content-Length: 337

[t=1660741655324] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"2","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/demo/roku-player/src/components/MainScene.bs"},"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/demo/roku-player/src/components/MainScene.bs","position":{"line":0,"character":11}}}

[t=1660741655329] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":0,"method":"workspace/workspaceFolders"}

[t=1660741655329] LSP4E to brighterscript-language-server-bin:
Content-Length: 122

[t=1660741655329] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":0,"result":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}

[t=1660741655335] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"scopeUri":"/Users/a206719281/eclipse-workspace/ocellus-src/","section":"files"}]}}

[t=1660741655336] LSP4E to brighterscript-language-server-bin:
Content-Length: 1915

[t=1660741655336] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Internal error.","data":"java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)\n\tat org.eclipse.lsp4e.LanguageServerWrapper.lambda$3(LanguageServerWrapper.java:270)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.reflect.InvocationTargetException\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:577)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)\n\t... 12 more\nCaused by: java.lang.UnsupportedOperationException\n\tat org.eclipse.lsp4j.services.LanguageClient.configuration(LanguageClient.java:138)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)\n\t... 14 more\n"}}

[t=1660741655409] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741655409] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"3","method":"shutdown","params":null}

[t=1660741655409] LSP4E to brighterscript-language-server-bin:
Content-Length: 60

[t=1660741655409] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"4","method":"shutdown","params":null}

[t=1660741655410] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741655410] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741655410] LSP4E to brighterscript-language-server-bin:
Content-Length: 47

[t=1660741655410] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"exit","params":null}

[t=1660741655421] LSP4E to brighterscript-language-server-bin:
Content-Length: 1580

[t=1660741655421] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"processId":3138,"rootPath":"/Users/a206719281/eclipse-workspace/ocellus-src/","rootUri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","delete","rename"],"failureHandling":"undo"},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true},"workspaceFolders":true},"textDocument":{"synchronization":{"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"completionItem":{"snippetSupport":true,"documentationFormat":["markdown","plaintext"]}},"hover":{"contentFormat":["markdown","plaintext"]},"signatureHelp":{},"references":{},"documentHighlight":{},"documentSymbol":{"symbolKind":{"valueSet":[18,17,5,14,9,10,22,24,8,1,12,11,20,6,2,3,21,16,19,25,4,7,15,23,26,13]},"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{},"definition":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"resolveSupport":{"properties":["edit"]},"dynamicRegistration":true},"codeLens":{},"documentLink":{},"colorProvider":{},"rename":{},"foldingRange":{}}},"clientName":"Eclipse IDE","trace":"off","workspaceFolders":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}}

[t=1660741655916] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":"1","result":{"capabilities":{"textDocumentSync":1,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."],"allCommitCharacters":[".","@"]},"documentSymbolProvider":true,"workspaceSymbolProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"full":true},"referencesProvider":true,"codeActionProvider":{"codeActionKinds":["refactor"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"hoverProvider":true,"executeCommandProvider":{"commands":["TranspileFile"]}}}}

[t=1660741655917] LSP4E to brighterscript-language-server-bin:
Content-Length: 52

[t=1660741655917] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"initialized","params":{}}

[t=1660741655918] LSP4E to brighterscript-language-server-bin:
Content-Length: 744

[t=1660741655918] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/demo/roku-player/src/components/MainScene.bs","languageId":"bs","version":1,"text":"import \"pkg:/source/roku_modules/rodash/rodash.brs\"\n\nsub init()\n    foo \u003d rodash.add(3, 5)\n\n    videocontent \u003d createObject(\"RoSGNode\", \"ContentNode\")\n    videocontent.title \u003d `Example Video: [${foo}]`\n    videocontent.streamformat \u003d \"hls\"\n    videocontent.url \u003d \"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8\"\n    video \u003d m.top.findNode(\"exampleVideo\")\n    video.content \u003d videocontent\n    video.setFocus(true)\n    video.control \u003d \"play\"\nend sub\n"}}}

[t=1660741655923] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":0,"method":"workspace/workspaceFolders"}

[t=1660741655923] LSP4E to brighterscript-language-server-bin:
Content-Length: 122

[t=1660741655923] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":0,"result":[{"uri":"file:///Users/a206719281/eclipse-workspace/ocellus-src/","name":"ocellus-src"}]}

[t=1660741655928] brighterscript-language-server-bin to LSP4E:
{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"scopeUri":"/Users/a206719281/eclipse-workspace/ocellus-src/","section":"files"}]}}

[t=1660741655930] LSP4E to brighterscript-language-server-bin:
Content-Length: 1915

[t=1660741655930] LSP4E to brighterscript-language-server-bin:
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Internal error.","data":"java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)\n\tat org.eclipse.lsp4e.LanguageServerWrapper.lambda$3(LanguageServerWrapper.java:270)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: java.lang.reflect.InvocationTargetException\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:577)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)\n\t... 12 more\nCaused by: java.lang.UnsupportedOperationException\n\tat org.eclipse.lsp4j.services.LanguageClient.configuration(LanguageClient.java:138)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)\n\t... 14 more\n"}}
pisv commented 2 years ago

Is it a "bug" (a missing implementation?) of lsp4j?

No, it is not a bug in LSP4J.

Looks like the language server sends the workspace/configuration request to LSP4E, but LSP4E does not provide the workspace.configuration capability:

https://github.com/eclipse/lsp4e/blob/8558db80395f0356cb99c6531371129eb443e3c4/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java#L287:L297

So, it seems to be a bug in the language server, since it should not send the request to a language client that does not support it.

ZeeD commented 2 years ago

OK. Sorry for the noise: I though that lsp4e was just a wrapper of lsp4j (that should support "workspace/configuration", correct?) but it seems it added additional requirements.

pisv commented 2 years ago

To clarify it a little bit, LSP4E is a language client implementation for Eclipse, which uses LSP4J to communicate with a language server.

It is up to a language client whether it supports requests such as workspace/configuration. If the language client opts to support such a request, it should be signaled to the language server via a client capability (workspace.configuration in this case). If the language client does not provide such a capability, the language server should not send the corresponding request to the client.

Since LSP4E opted not to provide the workspace.configuration capability, it would be a bug in a language server to send the workspace/configuration request to LSP4E. Although LSP4E could potentially be enhanced to support this request, this is not a requirement of the LSP spec. However, the specification requires that the server should not send the request if the client does not support it.

That's why I think this is a bug in the language server you are using.

HTH

ZeeD commented 2 years ago

Clear FYI I contacted the brs team and updated the server implementation to avoid sending the workspace/configuration request

pisv commented 2 years ago

Great! Thanks @ZeeD for the information.