Skip to content

Latest commit

 

History

History
48 lines (28 loc) · 2.51 KB

rust-analyzer.md

File metadata and controls

48 lines (28 loc) · 2.51 KB

Rust Language Server

You can use Rust Analyzer to benefit from Rust support:

Rust Analyzer Demo

by following these steps:

  1. Install Rust Language Server, by following these instructions:
  1. Open the New Language Server Dialog. This can usually be found under the IDE settings related to Language Server Protocol (LSP). For more information, refer to the New Language Server Dialog documentation.

  2. Select Rust Language Server as the template from the available options. This will populate the command field with a default command:

    • ${BASE_DIR}/rust-analyzer.exe for Windows OS.
    • sh -c ${BASE_DIR}/rust-analyzer for other OS.

    Rust Analyzer template

You need to adjust this command to point to the location of the extracted Rust Analyzer LSP asset.

  1. Optional: You may also customize the mappings section:

    Rust Analyzer template mappings

    or configuration section according to your preferences.

    Rust Analyzer template configuration

  2. Click OK to apply the changes. You should now have Rust language support enabled in your IDE, with the Rust language server integrated, and you should see the language server in the LSP console:

    Rust Analyzer in LSP Console

Syntax coloration

Today LSP4IJ doesn't support textDocument/semanticTokens (please vote at issue 238), the demo uses the Rust TextMate grammar that you can configure in IntelliJ via the Editor / TextMate Bundles settings.

Rust TextMate Bundles

You need to clone https://github.com/microsoft/vscode and reference this folder (which contains the package.json) to benefit from syntax coloration and language configuration (matching brackets, etc).