Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@ name: CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]

permissions:
contents: read

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: dtolnay/rust-toolchain@1.100.0
with:
components: rustfmt, clippy, rust-analyzer, rust-src
- run: cargo fmt --manifest-path backend/Cargo.toml --all --check
- run: cargo clippy --manifest-path backend/Cargo.toml --all-targets --locked -- -D warnings
- run: cargo test --locked --manifest-path backend/Cargo.toml
- run: cargo build --locked --manifest-path backend/Cargo.toml
- run: node scripts/run/actions.mjs backend/target/debug/backend

# The backend, the Cargo build provider that also starts rust-analyzer, built
# for each archive on the system that links it: a universal binary on macOS,
# x64 and ARM64 (cross-built with the MSVC ARM64 tools) on Windows. Its unit
# tests run where the runner can execute what it builds.
backend:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
Expand All @@ -37,15 +60,23 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install the Rust targets
shell: bash
run: rustup target add ${{ matrix.targets }}
- uses: dtolnay/rust-toolchain@1.100.0
with:
targets: ${{ matrix.targets }}
components: rust-analyzer, rust-src
- name: Test the backend
if: matrix.test
working-directory: backend
run: cargo test --locked
- name: Build the backend
run: node scripts/build-backend.mjs ${{ matrix.platform }}
- name: Execute current file and an individual test with rust-analyzer
if: matrix.test
shell: bash
run: |
backend=".artifacts/backend-${{ matrix.platform }}/backend"
if [[ "$RUNNER_OS" == Windows ]]; then backend+=".exe"; fi
node scripts/run/actions.mjs "$backend"
- uses: actions/upload-artifact@v4
with:
name: backend-${{ matrix.platform }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install the Rust targets
shell: bash
run: rustup target add ${{ matrix.targets }}
- uses: dtolnay/rust-toolchain@1.100.0
with:
targets: ${{ matrix.targets }}
- name: Build the backend
run: node scripts/build-backend.mjs ${{ matrix.platform }}
- uses: actions/upload-artifact@v4
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ cargo、rustup 和 rust-analyzer 用你电脑上的,CodeLLDB 在第一次调

本插件取代 `lithe-plugin-cargo`。两个插件都声明了 `cargo` 构建系统,不要同时启用。

## 当前文件与单个函数/测试运行

插件通过 rust-analyzer `experimental/runnables` 识别 main、测试模块和单个测试函数,保留 Cargo package、target、features、环境变量及精确 filter。

点击前重新读取文档、校验路径和版本,保存成功后才启动;rerun 会重新验证当前声明。工作区相对路径统一使用 `/`,拒绝绝对路径、盘符、反斜杠、`.`、`..` 与控制字符。构建窗口仍未提供测试树;单个测试可从编辑器 gutter 运行。

2026-11-30,Windows 11 x64 的真实运行、精确单测试、陈旧版本、保存失败、rerun 和不安全路径回归通过。截图由固定 Viva 无头宿主生成,覆盖明暗主题、中英文及 before/after/hover,见 [截图目录](docs/assets/current-file-runs/)。macOS 原生窗口仍待 CI/实机复验。后端构建工具链固定 Rust 1.100.0。

## 功能

| 功能 | 说明 |
Expand All @@ -31,6 +39,7 @@ cargo、rustup 和 rust-analyzer 用你电脑上的,CodeLLDB 在第一次调
| 工具链 | 找到电脑上的 cargo、rustup 和 rust-analyzer;项目可以固定用其中一个 Cargo |
| 设置预览 | Rust 语言页和 Cargo 构建工具页画出设置的效果,见下文“设置预览” |


## 设置和构建选项

**插件设置**(设置 → 插件 → Rust Support →「设置」,也显示在「语言与框架 › Rust」页),开关默认都开启:
Expand Down Expand Up @@ -181,7 +190,7 @@ rust-analyzer 和 CodeLLDB 的启动结果由 Lithe 记在插件的日志通道

## 本地打包

需要 Rust 工具链和对应的 target(`rustup target add`)、Node.js 22+ 和 `zip`。macOS 上构建 darwin(通用二进制,ad-hoc 签名),
需要 Rust 1.100.0 工具链和对应的 target(`rustup target add`)、Node.js 22+ 和 `zip`。macOS 上构建 darwin(通用二进制,ad-hoc 签名),
Windows 上构建 windows-x64 和 windows-arm64:

```bash
Expand Down
Loading
Loading