返回顶部
r

rust-analyzer-lspRust语言服务器

Rust language server (rust-analyzer) providing code intelligence and analysis for .rs files. Use when working with Rust code that needs autocomplete, go-to-definition, find references, error detection, or refactoring support.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,180
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

rust-analyzer-lsp

rust-analyzer LSP

通过 rust-analyzer 提供全面代码智能的 Rust 语言服务器集成。

功能

  • - 代码智能:自动补全、跳转到定义、查找引用
  • 错误检测:编译错误的实时诊断
  • 重构:重命名符号、提取函数/变量
  • 分析:宏展开、类型提示、内联提示
  • 支持的扩展名:.rs

安装

通过 rustup(推荐)

bash rustup component add rust-analyzer

通过 Homebrew(macOS)

bash brew install rust-analyzer

通过包管理器(Linux)

bash

Ubuntu/Debian

sudo apt install rust-analyzer

Arch Linux

sudo pacman -S rust-analyzer

手动下载

发布页面下载预构建二进制文件。

验证安装:
bash
rust-analyzer --version

使用

语言服务器在兼容 LSP 的编辑器中自动运行。手动操作:

格式化代码

bash cargo fmt

运行 linter

bash cargo clippy

构建和测试

bash cargo build cargo test

不构建进行检查

bash cargo check

配置

在项目根目录创建 .rust-analyzer.json:

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

集成模式

编辑 Rust 代码时:

  1. 1. rust-analyzer 提供实时诊断
  2. 运行 cargo fmt 格式化代码
  3. 使用 cargo clippy 进行 lint 检查
  4. 提交前运行 cargo test

常用 Cargo 命令

  • - cargo new - 创建新项目
  • cargo build - 编译项目
  • cargo run - 构建并运行
  • cargo test - 运行测试
  • cargo check - 快速编译检查
  • cargo clippy - 运行 linter
  • cargo fmt - 格式化代码
  • cargo doc --open - 生成并打开文档

更多信息

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 rust-analyzer-lsp-1776336140 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 rust-analyzer-lsp-1776336140 技能

通过命令行安装

skillhub install rust-analyzer-lsp-1776336140

下载

⬇ 下载 rust-analyzer-lsp v1.0.0(免费)

文件大小: 1.68 KB | 发布时间: 2026-4-17 14:25

v1.0.0 最新 2026-4-17 14:25
Initial release: Rust language server (rust-analyzer) for code intelligence and analysis.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部