ra-multiplex
ra-multiplex copied to clipboard
built-in process management
in order for this to be a full drop-in replacement it could be cool to:
- start
ra-multiplex-serverif it's not already running from withinra-multiplex - have
ra-multiplex-servershut down if it no longer holds any rust-analyzer instances
This functionality can be emulated by starting the server automatically every time you open your editor. Since it is trying to bind to the same port, it will just silently fail if there is already a server running.
Using Vim:
if executable('ra-multiplex-server')
autocmd FileType rust silent !(&>/dev/null ra-multiplex-server &)
endif
Just wanted to note that I tried to implement the original proposal but haven't finished anything yet because there isn't any cross-platform solution for daemonizing processes.
The crate daemonize seems to be the most portable way of implementing this at least on unix-like OSs, but it requires me to split the implementation from other platforms and forces me to tackle and decide on things that should be left for other process management tools, like where to log.
While I understand the appeal of the convenience this feels very out-of-scope for ra-mux-server, I'd consider a systemd user unit as a betterreplacement for most unix systems. Adding an example how to configure that in the documentation would be my prefered solution.
Here's what I'm using:
[Unit]
Description=Rust analyzer multiplexer server
[Service]
Type=simple
ExecStart=/usr/bin/ra-multiplex-server
Restart=always
RestartSec=5s
[Install]
WantedBy=default.target