[Feature] 将 Viva 构建窗口与结构窗口的树投影、筛选和展开规则下沉到 Rust Core

Open
#1,866 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
go, rust
Domain
desktop-dev

Research direction

Start in desktop/internal/workbench/build_tree.go and desktop/internal/workbench/outline.go to see which visibility, expansion, filtering and load-limit rules currently live in the Go layer. Then check the project-tree projection interface proposed in #1800 before designing a bounded, incremental contract in Lithe-core-rust with shared fixtures. Done means both trees use one shared projection reducer in Core, with the Go layer only passing inputs and applying results.

Written by the indexing model from the issue text.

Description

area:run enhancement platform:cross-platform refactor review: high
Problem to solve / 要解决的问题

本分支 feat/desktop-structure-build-panels 新增的两个 Viva 工具窗口,可见行规则都在 Go 界面层计算:

  • Build 窗口(desktop/internal/workbench/build_tree.go):决定哪些构建系统实例分组展开(默认只展开选中的实例,用户手动展开或折叠过的保持原状,依赖分组默认折叠);按分组名称、根目录和行名称筛选,并保留匹配行所在的分组;决定哪些展开的分组需要加载模型(同时最多 4 个,失败的不自动重试,折叠的不加载)。
  • 结构窗口(desktop/internal/workbench/outline.go):符号树的筛选(保留匹配项的祖先并计数)、排序、全部折叠或展开,以及选中项跟随光标所在符号。

按 develop-lithe 的逻辑归属规则,树和列表的投影、筛选、展开和选择这类可共享规则应由 Rust Core 持有,界面层只负责输入、焦点、绘制和原生监听。这些规则留在 Go 里,换 UI 壳子或出现其他 Core 消费者时就得重新实现一遍。目前没有已复现的跨平台结果不一致,因为两端用的是同一份 Viva 桌面代码。

Proposed solution / 建议方案

在 Lithe-core-rust 中为这两类树加入有界的投影规则,并补充共享契约和 fixture:

  • 构建树:输入是实例列表、已加载的模型、展开记忆和筛选文本,输出是可见行和需要加载的实例。
  • 符号树:输入是符号列表、筛选文本、排序方式、折叠状态和光标位置,输出是可见行、匹配数量和选中项。

界面层只传入增量或当前可见范围,然后应用返回的结果。实现前先核对 #1800 计划的项目树投影接口,三种树尽量共用同一套树投影 reducer,不要各写一份。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Run / 运行

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案
  • 继续放在 Go 界面层:接线最少,但规则与 Core 脱离,其他客户端用不上。
  • 每帧把整棵树传给 Core:会拖慢构建系统多、符号多的项目,所以接口要做成增量或有界的。
Additional context / 补充信息
  • 相关:#1794(Viva 工作台分阶段重构)、#1800(项目树可见行和导航规则下沉到 Core)。
  • 这是对代码的静态核对,不是运行时故障。
Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Dominant language
TypeScript
Stars
1.8k
Forks
151
Avg merge
3h 48m
Merged PRs (30d)
571

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.