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

Idea: wrap multiple servers #38

Open
jdtsmith opened this issue Jan 24, 2025 · 0 comments
Open

Idea: wrap multiple servers #38

jdtsmith opened this issue Jan 24, 2025 · 0 comments

Comments

@jdtsmith
Copy link
Contributor

Some servers are indented to be "add-ons", providing only certain features and expecting other servers to provide the rest. A classic combination is e.g. pyright + ruff-lsp. Juggling multiple servers is possible in many editors, and in Emacs with LSP (but not eglot). But all of the process contention and JSON performance issues that motivated this package are compounded when communicating with multiple LSP servers at the same time.

eglot-lsp-booster is well poised to help with this I think.

Imagine a call like:

emacs-lsp-booster --multiserver --json-false-value :json-false -- -c server1.cfg /path/to/server1  --server1-flags -- -c server2.cfg /path/to/server2 --server2-flags

With a call like this, emacs-lsp-booster would start and communicate with two different servers at the same time, caching and translating the requests to and responses from both.

Here server1.cfg and server2.cfg would be configuration files that instruct emacs-lsp-booster how set the priority for request types (these could also be passed as arguments). There would seem to be a number of ways to do this, but one simple idea:

  • If server1.cfg mentions a given request name, send those requests to it.
  • If it does not, but server2.cfg mentions it, send those requests to server2.
  • If neither server config mentions it, send to both.
  • Forward all responses from both servers to the client.

One thing to be worked out is capability registration during initialize, i.e. when the servers respond with their capabilities, like:

(:id 1 :jsonrpc "2.0" :result
     (:capabilities...

It might be nice if emacs-lsp-booster could "spy" on this traffic, merging the capabilities to send back to the client, and saving an internal table of capabilities per-server to help direct requests to the correct server.

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

1 participant