rust-analyzer-cli 0.3.0

A library and CLI tool built on top of rust-analyzer for codebase navigation
Documentation
---
name: rust-codebase-navigation
description: Search, locate, navigate, outline, and verify Rust codebase symbols, structs, functions, definitions, references, call hierarchies, and cargo check compilation using rust-analyzer LSP daemon.
---

# Rust Codebase Navigation

Use this skill for compiler-accurate Rust symbol lookup, document outlines, definitions, references, call hierarchy, type hierarchy, and compilation checks via `rust-analyzer-cli`.

## Setup & Daemon

Before querying, start the background `rust-analyzer-cli` daemon from the workspace root:

```powershell
rust-analyzer-cli daemon --workspace .
```

To check daemon & LSP indexing status:

```powershell
rust-analyzer-cli status [--json]
```

To restart the `rust-analyzer` LSP session:

```powershell
rust-analyzer-cli refresh [--json]
```

## Core Commands

```powershell
# 1. Search workspace symbols
rust-analyzer-cli symbol <name> [kind] [--exact] [--json]

# 2. Extract document symbol outline for file(s)
rust-analyzer-cli outline --file <path> [-o <output_file>] [--json]
rust-analyzer-cli outline --file-list <path1,path2> [--json]

# 3. Jump to symbol definition
rust-analyzer-cli definition --file <path> --line <line> --col <col> [--json]

# 4. Find references / call hierarchy (incoming/outgoing calls)
rust-analyzer-cli cursor --file <path> --line <line> --col <col> [--mode incoming|outgoing|references] [--depth <n>] [--json]

# 5. Query type hierarchy
rust-analyzer-cli type-hierarchy --file <path> --line <line> --col <col> [--mode supertypes|subtypes] [--depth <n>] [--json]

# 6. Run Cargo compilation verification check
rust-analyzer-cli check [--target <target>] [--json]
```

## Examples

```powershell
rust-analyzer-cli symbol LspClient fn
rust-analyzer-cli outline --file src/main.rs
rust-analyzer-cli definition --file src/main.rs --line 15 --col 10
rust-analyzer-cli cursor --file src/main.rs --line 25 --col 8 --mode incoming
rust-analyzer-cli check
```