Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 4, 2026·3 min de lectura

rust-analyzer — Intelligent Rust Language Server for Editors

A fast, feature-rich implementation of the Language Server Protocol for Rust that provides code completion, go-to-definition, type inference, and inline diagnostics in any LSP-compatible editor.

Introduction

rust-analyzer is the official Rust language server that brings IDE-quality features to any editor supporting the Language Server Protocol. It provides real-time code analysis, completion, refactoring, and diagnostics by building a full semantic model of your Rust project without running the compiler.

What rust-analyzer Does

  • Delivers real-time code completion with type-aware suggestions and auto-imports
  • Provides go-to-definition, find-references, and rename across the entire workspace
  • Shows inline type hints, parameter names, and inferred lifetimes
  • Offers code actions such as extract function, fill match arms, and generate implementations
  • Runs diagnostics and clippy checks incrementally as you type

Architecture Overview

rust-analyzer maintains an incremental, demand-driven computation graph using the Salsa framework. It parses Rust source into a concrete syntax tree, lowers it to a high-level intermediate representation, and resolves names, types, and traits lazily. This architecture allows sub-second response times even on large workspaces because only invalidated parts of the analysis are recomputed when a file changes.

Self-Hosting & Configuration

  • Install via rustup: rustup component add rust-analyzer
  • Or download pre-built binaries from the GitHub releases page
  • Configure in VS Code by installing the rust-analyzer extension from the marketplace
  • For Neovim, add rust-analyzer to your LSP configuration via nvim-lspconfig
  • Customize behavior with .cargo/config.toml and rust-analyzer.json in the project root

Key Features

  • Ships as an official rustup component, always in sync with the toolchain
  • Supports workspaces with hundreds of crates and proc-macro expansion
  • Provides structural search and replace via SSR patterns
  • Integrates with Cargo to resolve dependencies and feature flags automatically
  • Offers a robust API for editor plugin authors beyond the standard LSP

Comparison with Similar Tools

  • RLS (Rust Language Server) — deprecated predecessor; rust-analyzer replaced it as the official server
  • IntelliJ Rust — JetBrains plugin with its own analysis engine; rust-analyzer is editor-agnostic via LSP
  • clangd — equivalent language server for C/C++; rust-analyzer is Rust-specific with trait resolution
  • gopls — Go language server; similar LSP approach but for a different language
  • pylsp — Python language server; rust-analyzer handles Rust's complex type system and borrow checker

FAQ

Q: Is rust-analyzer the official Rust language server? A: Yes. It replaced the original RLS and ships as an official rustup component.

Q: Does it work with large monorepo workspaces? A: Yes. Its incremental architecture handles workspaces with hundreds of crates efficiently.

Q: Which editors are supported? A: Any editor with LSP support, including VS Code, Neovim, Helix, Emacs, Sublime Text, and Zed.

Q: Does it expand procedural macros? A: Yes. rust-analyzer can expand proc macros for analysis, though this requires a compatible toolchain.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados