Skip to content
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

Document JSON-RPC display protocol #422

Open
garrett-hopper opened this issue Jul 31, 2019 · 5 comments
Open

Document JSON-RPC display protocol #422

garrett-hopper opened this issue Jul 31, 2019 · 5 comments

Comments

@garrett-hopper
Copy link

I've begun looking into https://github.com/vshaxe/haxe-language-server to try to implement the new IDE features in a new Emacs mode, however I can't make heads or tails of how the JSON-RPC works.
Some additional documentation to https://haxe.org/manual/cr-completion-overview.html regarding its usage would be great.

@Gama11
Copy link
Member

Gama11 commented Jul 31, 2019

Unrelated, but have you considered using the language server / language server protocol directly?

@garrett-hopper
Copy link
Author

I have; it works well. It feels like it's tied pretty tightly to the vshaxe plugin, and I'd like something more lightweight.

@Gama11
Copy link
Member

Gama11 commented Jul 31, 2019

Tied tightly to the plugin in what way?

Anyway:

I can't make heads or tails of how the JSON-RPC works

What part are you having trouble with? I'd think it's mostly about looking at the type definitions for the available requests, their parameters and their responses (https://github.com/vshaxe/haxe-language-server/tree/master/src/haxeLanguageServer/protocol).

@garrett-hopper
Copy link
Author

Perhaps that's not a fair assessment. It's been a while since I've built the lsp server. The only thing I can thing of at the moment is the need to use https://github.com/vshaxe/vshaxe-build in order to build it. (Though I'm sure there are ways around that.) Overall it just didn't seem very simple to implement with non-VSCode editor.

At the end of the day, I guess I just don't like the idea of having Emacs talk to a node server which is running on top of Haxe's compilation server. It just feels like overkill.

At the moment I'm having trouble figuring out what exactly needs to be sent to the command. I've figured out the haxe --wait stdio, but I'm not sure how that interacts with -D display-stdin.
I'm also unclear on the formatting around haxe --wait stdio; I know there is some message length stuff and weird characters that need to be sent, but I can't seem to figure them out.

I'm trying to figure this out from the terminal at the moment before I move to an elisp implementation.

So if I wanted to get a response for hovering over some class name, I'd need to do something like:

  • Startup haxe --wait stdio
  • Send the -D display-stdin
  • Send the contents of the file (with some characters before and after)
  • Send some json formatted request with display/hover somewhere in it

I'm going to read some documentation on JSON-RPC; maybe that's what I'm missing. Once the server is running and listening on stdin, it just accepts normal JSON-RPC requests, right?

@Gama11
Copy link
Member

Gama11 commented Jul 31, 2019

--wait stdio / display-stdin isn't really related to JSON-RPC / required for it. In fact, it may be better to use a regular socket connection since it's less error-prone. That's probably going to change at some point in haxe-language-server too: vshaxe/vshaxe#217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants