diff options
author | Sadaf Ebrahimi <sadafebrahimi@google.com> | 2022-11-11 23:35:38 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-11-11 23:35:38 +0000 |
commit | 40214b48188358a80b7478bfff21d4814dd9177c (patch) | |
tree | 77dc031614745bb406dbd90cea9a082a1b5cdd54 /rust-analyzer-chromiumos-wrapper/README.md | |
parent | a51582ad9cb50ec284f4718765bd5d31fa0069d4 (diff) | |
parent | 584b8e46d146a2bcfeffd64448a2d8e92904168d (diff) | |
download | toolchain-utils-40214b48188358a80b7478bfff21d4814dd9177c.tar.gz |
Upgrade toolchain-utils to 2c474af4f370b143032144aff1ff1985f789e20f am: 8b320f7173 am: d444309511 am: 584b8e46d1android-14.0.0_r45android-14.0.0_r44android-14.0.0_r43android-14.0.0_r42android-14.0.0_r41android-14.0.0_r40android-14.0.0_r39android-14.0.0_r38android-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android-14.0.0_r21android-14.0.0_r20android-14.0.0_r19android-14.0.0_r18android-14.0.0_r17android-14.0.0_r16aml_rkp_341510000aml_rkp_341311000aml_rkp_341114000aml_rkp_341015010aml_rkp_341012000aml_hef_341717050aml_hef_341613000aml_hef_341512030aml_hef_341415040aml_hef_341311010aml_hef_341114030aml_cfg_341510000android14-qpr1-s2-releaseandroid14-qpr1-releaseandroid14-mainline-healthfitness-releaseandroid14-devandroid14-d2-s5-releaseandroid14-d2-s4-releaseandroid14-d2-s3-releaseandroid14-d2-s2-releaseandroid14-d2-s1-releaseandroid14-d2-release
Original change: https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/2292563
Change-Id: Ida212764c332af8ba8ab8aaa62a7d2a007e3314e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'rust-analyzer-chromiumos-wrapper/README.md')
-rw-r--r-- | rust-analyzer-chromiumos-wrapper/README.md | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/rust-analyzer-chromiumos-wrapper/README.md b/rust-analyzer-chromiumos-wrapper/README.md new file mode 100644 index 00000000..e834ff34 --- /dev/null +++ b/rust-analyzer-chromiumos-wrapper/README.md @@ -0,0 +1,61 @@ +# rust-analyzer-chromiumos-wrapper + +## Intro + +rust-analyzer is an LSP server for the Rust language. It allows editors like +vim, emacs, or VS Code to provide IDE-like features for Rust. + +This program, `rust-analyzer-chromiumos-wrapper`, is a wrapper around +`rust-analyzer`. It exists to translate paths between an instance of +rust-analyzer running inside the chromiumos chroot and a client running outside +the chroot. + +It is of course possible to simply run `rust-analyzer` outside the chroot, but +version mismatch issues may lead to a suboptimal experience. + +It should run outside the chroot. If invoked in a `chromiumos` repo in a +subdirectory of either `chromiumos/src` or `chromiumos/chroot`, it will attempt +to invoke `rust-analyzer` inside the chroot and translate paths. Otherwise, it +will attempt to invoke a `rust-analyzer` outside the chroot and will not +translate paths. + +It supports none of rust-analyzer's command line options, which aren't +necessary for acting as a LSP server anyway. + +## Quickstart + +*Outside* the chroot, install the `rust-analyzer-chromiumos-wrapper` binary: + +``` +cargo install --path /path-to-a-chromiumos-checkout/src/third_party/toolchain-utils/rust-analyzer-chromiumos-wrapper +``` + +Make sure `~/.cargo/bin' is in your PATH, or move/symlink `~/.cargo/bin/rust-analyzer-chromiumos-wrapper` to a location in your PATH. + +Configure your editor to use the binary `rust-analyzer-chromiumos-wrapper` as +`rust-analyzer`. In Neovim, if you're using +[nvim-lspconfig](https://github.com/neovim/nvim-lspconfig), this can be done by +putting the following in your `init.lua`: + +``` +require('lspconfig')['rust_analyzer'].setup { + cmd = {'rust-analyzer-chromiumos-wrapper'}, +} +``` + +This configuration is specific to your editor, but see the +[Rust analyzer manual](https://rust-analyzer.github.io/manual.html) for +more about several different editors. + +Once the above general configuration is set up, you'll need to install +`rust-analyzer` inside each chroot where you want to edit code: +``` +sudo emerge rust-analyzer +``` + +## Misc + +A wrapper isn't necessary for clangd, because clangd supports the option +`--path-mappings` to translate paths. In principle a similar option could be +added to `rust-analyzer`, obviating the need for this wrapper. See this +[issue on github](https://github.com/rust-lang/rust-analyzer/issues/12485). |