scry icon indicating copy to clipboard operation
scry copied to clipboard

Extract LSP protocol to a shard?

Open asterite opened this issue 6 years ago • 2 comments

Hi!

I'd like to try my hands on building an LSP server implementation using the knowledge I have about the compiler. I thought about contributing to this project but for me it might be easier to start from scratch because of some ideas I have (I plan on reusing the top-level semantic pass of the compiler, which doesn't seem to be used here).

To do that it seems the first step for me is to define all the boilerplate for the language server protocol. And that seems to be here! But it's embedded in scry's source code...

Do you think there's a chance the protocol can be extracted to its own shard? Then we don't have to repeat the protocol in every attempt at a language server. I see there's https://github.com/crystal-lang-tools/lsp but it seems undocumented and with many TODOs so I'm not confident about it.

I'm also thinking maybe the shard could have a way to easily use it so all you have do to is do something like LSP.start(listener) and listener would be some class where you have to implement some methods, one for each message/notification you can get from the language server client. I think that would also simplify the source code of scry.

What do you think? And also let me know how can I help accomplishing that.

asterite avatar Jul 12 '19 15:07 asterite

I also found this: https://github.com/jemc/mare/tree/master/lib/lsp , so it seems LSP is already repeated in several places... it would be great to unify all of that!

asterite avatar Jul 12 '19 15:07 asterite

Hey @asterite

There was already a similar issue on this(https://github.com/crystal-lang-tools/scry/issues/111), so I just went ahead and made a PR for this

The LSP shard you mentioned was made for the very purpose of extracting the LSP protocol code from Scry(as far as i understand from the aforementioned issue)

dnamsons avatar Sep 01 '19 11:09 dnamsons