tools
tools copied to clipboard
📎 Add `lsp` command
Description
Rome offers a lsp server today that clients can connect to by opening the rome __print_socket
socket.
However, not all editors have built-in support to connect to an LSP socket and, instead communicate with the LSP by reading/writing output to the LSP process stdout/stdin. The lack of Rome's support for an LSP that communicates via stdin/stdout can be worked around by using nc
but having such capability backed into Rome would ease the integration into editors like vim, or Lapce.
Goal
Add a rome lsp
or rome lsp-proxy
command that starts an LSP server that communicates via stdin/stdout.
Implementation
The best place to implement this command would probably be in rome_cli/src/commands/daemon.rs, the proxy command would then need to:
- Call service::ensure_daemon() make sure the server is running
- Call service::open_socket() to get a connection to the server
- Spawn two asynchronous tasks on a tokio Runtime to copy data from stdin to the socket's "write half", and from the socket's "read half" to stdout respectively (this should be as simple as calling tokio::io::copy in both tasks)
- Synchronously block the main thread on the two joined asynchronous task
oh, I'll try to contribute code for the command.