rust-code-navigator by zhanghandong/rust-skills
npx skills add https://github.com/zhanghandong/rust-skills --skill rust-code-navigator使用语言服务器协议高效导航大型 Rust 代码库。
/rust-code-navigator <symbol> [in file.rs:line]
示例:
/rust-code-navigator parse_config - 查找 parse_config 的定义/rust-code-navigator MyStruct in src/lib.rs:42 - 从特定位置开始导航查找符号定义的位置。
LSP(
operation: "goToDefinition",
filePath: "src/main.rs",
line: 25,
character: 10
)
使用场景:
查找符号的所有使用位置。
LSP(
operation: "findReferences",
filePath: "src/lib.rs",
line: 15,
character: 8
)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用场景:
获取符号的类型和文档。
LSP(
operation: "hover",
filePath: "src/main.rs",
line: 30,
character: 15
)
使用场景:
User: "Where is the Config struct defined?"
│
▼
[1] 在工作区中搜索 "Config"
LSP(operation: "workspaceSymbol", ...)
│
▼
[2] 如果存在多个结果,请用户澄清
│
▼
[3] 转到定义
LSP(operation: "goToDefinition", ...)
│
▼
[4] 显示文件路径和上下文
读取周围代码以获取上下文
## Config (struct)
**定义位置:** `src/config.rs:15`
```rust
#[derive(Debug, Clone)]
pub struct Config {
pub name: String,
pub port: u16,
pub debug: bool,
}
```
**文档:** 应用程序服务器的配置。
## 对 `Config` 的引用(找到 5 处)
| 位置 | 上下文 |
|----------|---------|
| src/main.rs:10 | `let config = Config::load()?;` |
| src/server.rs:25 | `fn new(config: Config) -> Self` |
| src/server.rs:42 | `self.config.port` |
| src/tests.rs:15 | `Config::default()` |
| src/cli.rs:8 | `config: Option<Config>` |
| 用户提问 | LSP 操作 |
|---|---|
| "X 定义在哪里?" | goToDefinition |
| "谁使用了 X?" | findReferences |
| "X 是什么类型?" | hover |
| "查找所有结构体" | workspaceSymbol |
| "这个文件里有什么?" | documentSymbol |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| "没有 LSP 服务器" | rust-analyzer 未运行 | 建议:rustup component add rust-analyzer |
| "未找到符号" | 拼写错误或不在作用域内 | 先使用 workspaceSymbol 搜索 |
| "多个定义" | 泛型或宏 | 显示所有定义并让用户选择 |
| 场景 | 查看 |
|---|---|
| 调用关系 | rust-call-graph |
| 项目结构 | rust-symbol-analyzer |
| Trait 实现 | rust-trait-explorer |
| 安全重构 | rust-refactor-helper |
每周安装量
552
代码仓库
GitHub 星标数
912
首次出现
Jan 22, 2026
安全审计
安装于
opencode507
codex494
gemini-cli484
github-copilot477
amp431
kimi-cli428
Navigate large Rust codebases efficiently using Language Server Protocol.
/rust-code-navigator <symbol> [in file.rs:line]
Examples:
/rust-code-navigator parse_config - Find definition of parse_config/rust-code-navigator MyStruct in src/lib.rs:42 - Navigate from specific locationFind where a symbol is defined.
LSP(
operation: "goToDefinition",
filePath: "src/main.rs",
line: 25,
character: 10
)
Use when:
Find all usages of a symbol.
LSP(
operation: "findReferences",
filePath: "src/lib.rs",
line: 15,
character: 8
)
Use when:
Get type and documentation for a symbol.
LSP(
operation: "hover",
filePath: "src/main.rs",
line: 30,
character: 15
)
Use when:
User: "Where is the Config struct defined?"
│
▼
[1] Search for "Config" in workspace
LSP(operation: "workspaceSymbol", ...)
│
▼
[2] If multiple results, ask user to clarify
│
▼
[3] Go to definition
LSP(operation: "goToDefinition", ...)
│
▼
[4] Show file path and context
Read surrounding code for context
## Config (struct)
**Defined in:** `src/config.rs:15`
```rust
#[derive(Debug, Clone)]
pub struct Config {
pub name: String,
pub port: u16,
pub debug: bool,
}
```
**Documentation:** Configuration for the application server.
## References to `Config` (5 found)
| Location | Context |
|----------|---------|
| src/main.rs:10 | `let config = Config::load()?;` |
| src/server.rs:25 | `fn new(config: Config) -> Self` |
| src/server.rs:42 | `self.config.port` |
| src/tests.rs:15 | `Config::default()` |
| src/cli.rs:8 | `config: Option<Config>` |
| User Says | LSP Operation |
|---|---|
| "Where is X defined?" | goToDefinition |
| "Who uses X?" | findReferences |
| "What type is X?" | hover |
| "Find all structs" | workspaceSymbol |
| "What's in this file?" | documentSymbol |
| Error | Cause | Solution |
|---|---|---|
| "No LSP server" | rust-analyzer not running | Suggest: rustup component add rust-analyzer |
| "Symbol not found" | Typo or not in scope | Search with workspaceSymbol first |
| "Multiple definitions" | Generics or macros | Show all and let user choose |
| When | See |
|---|---|
| Call relationships | rust-call-graph |
| Project structure | rust-symbol-analyzer |
| Trait implementations | rust-trait-explorer |
| Safe refactoring | rust-refactor-helper |
Weekly Installs
552
Repository
GitHub Stars
912
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode507
codex494
gemini-cli484
github-copilot477
amp431
kimi-cli428
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装