ebkalderon / tower-lsp

Language Server Protocol implementation written in Rust
Apache License 2.0
951 stars 54 forks source link

Split the generic lsp-like backend from the lsp-specific implementation #391

Open agluszak opened 1 year ago

agluszak commented 1 year ago

Hi! I'd like to write a rust library for Build Server Protocol I co-maintain at JetBrains. I could fork tower-lsp, but it turns out that the implementation is pretty much generic and could be used for any JSON-RPC, LSP-like protocol (which BSP happens to be). I propose to split this crate into two: tower-lsp and tower-lsp-backend (or tower-lsp-like, tower-lsp-generic). The first one would depend on and use the lsp_types crate, the other one would just provide the "backend" for it.

agluszak commented 1 year ago

I'm implementing a prototype of how that could look like

ebkalderon commented 11 months ago

Interesting! It sounds like you might be looking to extract the JSON-RPC machinery out of tower-lsp into a separate crate. Is this understanding accurate? If so, that sounds like a pretty interesting idea. Granted, the internal Router is tightly coupled to the Language Server Protocol (on purpose, to be as fast and no-frills as possible), but I think it would be neat to pull it out to another crate someday. :relaxed:

To play devil's advocate, though: considering the limitations of the current implementation (e.g. #284) and significant changes planned for this library in the future, I worry that extracting the JSON-RPC stuff outside tower-lsp at this stage might make it harder to iterate and fix bugs in the future. That's not to say I'm against the idea, though! I wouldn't mind seeing this happen eventually, so feel free to share your prototype here if you'd like.