rust-analyzer-lsp

Verified·Scanned 2/17/2026

Provides rust-analyzer LSP integration for Rust code editing and analysis. The skill includes shell commands such as rustup component add rust-analyzer and cargo build, and directs downloading from https://github.com/rust-lang/rust-analyzer/releases.

from clawhub.ai·v2a3eaa0·2.3 KB·0 installs
Scanned from 1.0.0 at 2a3eaa0 · Transparency log ↗
$ vett add clawhub.ai/bowen31337/rust-analyzer-lsp

rust-analyzer LSP

Rust language server integration providing comprehensive code intelligence through rust-analyzer.

Capabilities

  • Code intelligence: Autocomplete, go-to-definition, find references
  • Error detection: Real-time diagnostics for compilation errors
  • Refactoring: Rename symbols, extract function/variable
  • Analysis: Macro expansion, type hints, inlay hints
  • Supported extensions: .rs

Installation

Via rustup (recommended)

rustup component add rust-analyzer

Via Homebrew (macOS)

brew install rust-analyzer

Via package manager (Linux)

# Ubuntu/Debian
sudo apt install rust-analyzer

# Arch Linux
sudo pacman -S rust-analyzer

Manual download

Download pre-built binaries from the releases page.

Verify installation:

rust-analyzer --version

Usage

The language server runs automatically in LSP-compatible editors. For manual operations:

Format code

cargo fmt

Run linter

cargo clippy

Build and test

cargo build
cargo test

Check without building

cargo check

Configuration

Create .rust-analyzer.json in project root:

{
  "checkOnSave": {
    "command": "clippy"
  },
  "inlayHints": {
    "typeHints": true,
    "parameterHints": true
  }
}

Integration Pattern

When editing Rust code:

  1. rust-analyzer provides real-time diagnostics
  2. Run cargo fmt to format code
  3. Use cargo clippy for linting
  4. Run cargo test before committing

Common Cargo Commands

  • cargo new <name> - Create new project
  • cargo build - Compile project
  • cargo run - Build and run
  • cargo test - Run tests
  • cargo check - Fast compile check
  • cargo clippy - Run linter
  • cargo fmt - Format code
  • cargo doc --open - Generate and open docs

More Information