Allow running language servers inside a `meson devenv`
Currently there is no way to run the language server inside a meson devenv
(or I haven't found a way to do that).
Running them in a meson devenv
would help to prevent compiling stuff twice for Rust projects (by both meson/cargo and rust-analyzer/cargo) by sharing the CARGO_TARGET_DIR
with the following snippet in meson.build
:
devenv = environment()
devenv.set('CARGO_HOME', meson.project_build_root() / 'cargo-home')
devenv.set('CARGO_TARGET_DIR', meson.project_build_root() / 'target') # this is the dir passed to cargo by meson
# which will then be picked up by rust-analyzer
meson.add_devenv(devenv)