eclipselabs/eclipse-language-service

Please store JSON server, CSS server in this github project

Closed this issue · 9 comments

I'm on Windows 64 bits and I try to consume JSON server but without success:

When I hover, open completion, etc teh launch starts but the "initialize" is never done. It seems that the server jsonServerMain don't give me any response.

Could you please store the jsonServerMain + node_modules dependencies in order to I check my problem comes from this server. More it will be more easy for other people who wish play with your work.

Thanks!

@angelozerr You need to apply a small change in the jsonServerMain.js file.

Replace this line:

var connection = vscode_languageserver_1.createConnection();

with:

var connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.StreamMessageReader(process.stdin), new vscode_languageserver_1.StreamMessageWriter(process.stdout));

I am not really sure why this change is necessary, but the same is done to make it working for Che.

@kaloyan-raev is right. It's currently kind of documented (in a non-accessible way) in https://github.com/eclipselabs/eclipse-language-service/blob/master/org.eclipse.languageserver/src/org/eclipse/languageserver/languages/InitializeLaunchConfigurations.java#L125 .
This change on language server is for the moment necessary as I didn't find a way to have Launch Configuration interacting with other streams than stdio/stdout. VSCode language servers by default some other stream. If you know how to connect to those streams from a Java process, that would be welcome and we could change the LaunchConfiguration to not require this tweak in the servers.

Many thanks @kaloyan-raev ! Without your help, I think I could not fix my problem.

If you know how to connect to those streams from a Java process, that would be welcome and we could change the LaunchConfiguration to not require this tweak in the servers.

The answer of your problem is in the line https://github.com/Microsoft/vscode-languageserver-node/blob/master/server/src/main.ts#L742

You must add --stdio in your launch arguments and it works great!

You must add --stdio in your launch arguments and it works great!

Awesome, I see it's a relatively recent change, I didn't notice it!
That's definitely something we need to adopt ASAP to get rid of the need to tweak the server. If you have some time to contribute that, it'd be welcome!

Awesome

Thanks!

If you have some time to contribute that, it'd be welcome!

A quick fix is to add this parameter for each launch. But IMHO, I think we should have a custom launch for Language Service based on CLI JSDT. We could hard coded this --stdio parameter.

We could have a generic launch for Language Service (for CSS, JSON) and develop custom launch based on the Language Server launch for other like OmniSharp which seems to require other parameter. After that we could have a cool UI for launch like just

  • path of jsonMailServer, cssMainServer, etc
  • or embed jsonMailServer.

like I have done for typescript.java for tsserver (which can be compared to language server):

See https://github.com/angelozerr/typescript.java/wiki/Configuration#server

And have an another preferences for nodejs path which is shared for any server like I have done for typescript.java https://github.com/angelozerr/typescript.java/wiki/Configuration#configure-typescript

@mickaelistria I have done a PR. See #31

But I think it should be really better to implement my below idea (just fine time-().

Thanks for PR #31
For the moment, I don't want to introduce IP complexity by embedding those. Once we're at Eclipse.org, we'll be able to discuss it again.

With the PR you provided, a solution is simply to install VSCode locally, and to make the Launch Configuration reference path under the VSCode installation.

Let's close it. It's now easier to consume VSCode installation directly, and as it's important to keep this project standalone and IP-clean for a successful move to Eclipse.org, I'd really like to avoid adding dependencies or code here that's not authored by Eclipse contributors.
You can create in some other project some additional plugins which include directly the servers. It's mostly a matter of mimicking the org.eclipse.languageserver.languages bundle, but referencing content that is installed or provided by the bundle.