Skip to content

Idea: wrap multiple servers #38

@jdtsmith

Description

@jdtsmith

Some servers are intended 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions