6 releases (breaking)

0.8.0 Sep 1, 2021
0.7.0 Aug 30, 2021
0.6.1 Aug 27, 2021
0.6.0 Jun 15, 2021
0.4.1 Sep 20, 2020

#11 in #listen

MIT license

88KB
2K SLoC

lsp-ws-proxy

WebSocket proxy for Language Servers.

Usage

$ lsp-ws-proxy --help

Usage: lsp-ws-proxy [-l <listen>] [-s] [-r] [-v]

Start WebSocket proxy for the LSP Server.
Anything after the option delimiter is used to start the server.

Multiple servers can be registered by separating each with an option delimiter,
and using the query parameter `name` to specify the command name on connection.
If no query parameter is present, the first one is started.

Examples:
  lsp-ws-proxy -- rust-analyzer
  lsp-ws-proxy -- typescript-language-server --stdio
  lsp-ws-proxy --listen 8888 -- rust-analyzer
  lsp-ws-proxy --listen 0.0.0.0:8888 -- rust-analyzer
  # Register multiple servers.
  # Choose the server with query parameter `name` when connecting.
  lsp-ws-proxy --listen 9999 --sync --remap \
    -- typescript-language-server --stdio \
    -- css-languageserver --stdio \
    -- html-languageserver --stdio

Options:
  -l, --listen      address or port to listen on (default: 0.0.0.0:9999)
  -s, --sync        write text document to disk on save, and enable `/files`
                    endpoint
  -r, --remap       remap relative uri (source://)
  -v, --version     show version and exit
  --help            display usage information

Why?

Remote Language Server is necessary when it's not possible to run the server next to the client.

For example, this can be used to let in-browser editors like CodeMirror and Monaco to use any Language Servers. See qualified/lsps for an example of using proxied Rust Analyzer with CodeMirror.

Features

  • Proxy messages
  • Synchronize files
  • Manipulate remote files with POST /files
  • Remap relative DocumentUri (source://)

Dependencies

~14–25MB
~381K SLoC