Trouble Launching Language Server Jar in VSCode Extension [message #1860967] |
Tue, 12 September 2023 08:47  |
Eclipse User |
|
|
|
I'm closer than I've ever been to getting a basic VSCode extension working with the LSP support, but I'm still a failure. :-(
I've built a LS that appears to work. I've built it from the Xtext example project - mydsl. Built in Eclipse 2022-06 using Xtext 27.0 using maven install. I've been able to launch that server and prove that it works by launching a Generic Text Editor in my 2022-06 Eclipse (notwithstanding the bugs in the packaged LSP4J that don't highlight errors, but I get content suggestions so I know it works.)
Troubles I'm still having:
I package the extension using vsce on my Windows machine (it's not easy for me to install stuff on the company's load share linux systems, so I have to do some things on Windows). The packaging is invoked on Windows but pointing to the mounted linux disk.
These next questions are client/node based - which I know aren't directly xtext questions, but they are things it seems people must've struggled with in creating these extensions.
vsce changes permissions of my launch scripts in src/bin/mydsl-standalone and makes it not executable. Which means I have to manually change permissions on this script once the extension is installed within VSCode. Bizarre. Why does it do this?
Second problem - and the show stopper - no matter what I do, when I load a file with the *.mydsl extension, my launcher script runs, but the server will not start. I get the message:
Quote:Error: Unable to access jarfile org.xtext.example.mydsl.ide-1.0.0-SNAPSHOT-ls.jar
[Error - 5:29:04 AM] Server initialization failed.
Message: Cannot call write after a stream was destroyed
Code: -32099
I can execute this launcher and access the jar only if I'm in the src/bin/ directory where it is located. I get the same message if I invoke the launcher manually from another directory. I'm spelling it correctly. I an invoke from that directory but not from another directory.
But VSCode _must_ be able to use the relative path to the jar right? It has to because it can't know where the user's extension will be stored.
script contents:
/usr/lib/jvm/jre-11/bin/java -jar org.xtext.example.mydsl.ide-1.0.0-SNAPSHOT-ls.jar
note that "java" defaults to Java 1.8 on these machines and to run Java 11, I have to point to a specific Java 11 jvm. I have not aliased "java" or changed env var JAVA_HOME.
Any ideas on what dumb thing I'm doing? This seems like it obviously must work like this as every example I can find specifies this launcher script. I've debugged that the server works in Eclipse. Why can't VSCode "access" this jar? I've double checked all the "file not found" type problems and it's not that.
[Updated on: Tue, 12 September 2023 08:49] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04493 seconds