This manual focuses on a specific usage of the library -- running it as part of a server that implements the
https://microsoft.github.io/language-server-protocol/[Language Server Protocol] (LSP).
The LSP allows various code editors, like VS Code, Emacs or Vim, to implement semantic features like completion or goto definition by talking to an external language server process.
The server binary is stored in `~/.config/Code/User/globalStorage/matklad.rust-analyzer` (Linux) or in `~/.Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer` (macOS) or in `%APPDATA%\Code\User\globalStorage` (Windows).
The extension will be updated automatically as new versions become available. It will ask your permission to download the matching language server version binary if needed.
We ship nightly releases for VS Code. To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config:
You will be prompted to install the `nightly` extension version. Just click `Download now` and from that moment you will get automatic updates every 24 hours.
Other editors generally require the `rust-analyzer` binary to be in `$PATH`.
You can download the pre-built binary from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page. Typically, you then need to rename the binary for your platform, e.g. `rust-analyzer-mac` if you're on Mac OS, to `rust-analzyer` and make it executable in addition to moving it into a directory in your `$PATH`.
Alternatively, you can install it from source using the following command:
Prerequisites: You have installed the <<language-server-binary,`rust-analyzer` binary>>.
You also need the `LSP` package. To install it:
1. If you've never installed a Sublime Text package, install Package Control:
* Open the command palette (Win/Linux: `ctrl+shift+p`, Mac: `cmd+shift+p`)
* Type `Install Package Control`, press enter
2. In the command palette, run `Package control: Install package`, and in the list that pops up, type `LSP` and press enter.
Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up enable to enable the rust-analyzer LSP. The latter means that rust-analzyer is enabled by default in Rust projects.
If it worked, you should see "rust-analzyer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available.
If you get an error saying `No such file or directory: 'rust-analyzer'` even though the binary is on your `$PATH`, there is likely a problem where Sublime doesn't see the same `$PATH` as your shell, see https://github.com/rust-analyzer/rust-analyzer/issues/1811[this issue]. On Unix, if you installed Rust with `rustup`, moving the binary to `$HOME/.cargo/bin` should help.