Open garrett-hopper opened 5 years ago
Unrelated, but have you considered using the language server / language server protocol directly?
I have; it works well. It feels like it's tied pretty tightly to the vshaxe plugin, and I'd like something more lightweight.
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).
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:
haxe --wait stdio
-D display-stdin
display/hover
somewhere in itI'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?
--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: https://github.com/vshaxe/vshaxe/issues/217
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.