Skip to content

sublimelsp/LSP-rust-analyzer

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

LSP-rust-analyzer

This is a helper package that starts the rust-analyzer language server for you.

Installation

  1. Install LSP via Package Control.
  2. Install LSP-rust-analyzer via Package Control.
  3. (Recommended) Install the LSP-file-watcher-chokidar via Package Control to enable functionality to notify the server about changed files.

Configuration

You can edit the global settings by opening the Preferences: LSP-rust-analyzer Settings from the Command Palette.

You can also have a project-specific configuration. Run the Project: Edit Project from the Command Palette and edit the following in the settings object.

{
    // folders: [
    //   ...
    // ]
    "settings": {
        "LSP": {
            "rust-analyzer": {
                "settings": {
                    //Setting-here
                }
            }
        }
    }
}

Applicable Selectors

This language server operates on views with the source.rust base scope.

Installation Location

The server binary is automatically downloaded to $CACHE/Package Storage/LSP-rust-analyzer.

Custom Command Palette Commands

LSP-rust-analyzer: Run...

Select a cargo command from the submenu. This spawns a shell with Terminus for tests, checks and executing code.

Note: The Terminus package needs to be installed for this functionality.

Example

LSP-rust-analyzer: Open Docs Under Cursor

Opens the URL to documentation for the symbol under the cursor, if available.

LSP-rust-analyzer: Reload Project

Reloads the project metadata, i.e. runs cargo metadata again.

LSP-rust-analyzer: Expand Macro Recursively

Shows the full macro expansion of the macro at current cursor.