Repository navigation
feat(lsp-policy): 引用工具窗口的分组、树行与用法行交给 Core - #80
Merged
Merged
Conversation
新增 lsp.references.query:把查找用法的位置按文件分组(文件按项目视图的自然文件名顺序,用法按行列), 按平台传来的折叠状态和选中键给出可见行、每行预览的用法、前后用法,并把被折叠节点挡住的选中移到该节点。 新增 lsp.references.lines:按搜索结果行的同一规则显示用法所在行(去缩进和换行、远处用法前截断加省略号、 最多 240 字节),高亮用法范围。规则放在 lithe-text 的 line_preview。 workspace.search 在 includeContentRanges 时,内容匹配的 preview 也按 line_preview 生成,并返回 previewRanges,桌面端的查找结果和随处搜索不再各自裁剪行。 两个命令的用例在 rust/fixtures/lsp/references-*-v1.json,契约写进 rust-core-api.md。 Refs 1lck/Lithe-IDEA#2096
xiaoyumuxi
added a commit
to 1lck/Lithe-IDEA
that referenced
this pull request
Nov 17, 2026
- 新增 core.ReferencesQuery / ReferencesLines,桥接 Core 的 lsp.references.query、 lsp.references.lines;桌面端删掉 Go 里的分组排序、可见行投影、选中转移、 上一个/下一个用法和行裁剪,只保留折叠状态、选中键、读文件与绘制 - 文件分组改为项目视图的自然文件名顺序;用法行文本在后台由 Core 裁剪后回填 - workspace.search 返回 previewRanges,查找结果和随处搜索不再各自裁剪行 - 编辑器右键菜单“查找引用”改为“查找用法”(仍是 Shift+F12),右键点在选区外 时查的是被点的词,补单元测试 - PINNED_CORE_REVISION 固定 Core #80 分支提交 81a6ecf,合入后改为 main 的合并提交 - 更新 references-pane 功能矩阵 Refs #2096, Lithe-IDEA/Lithe-core-rust#80
xiaoyumuxi
marked this pull request as ready for review
November 17, 2026 11:16
28 of 34 tasks
xiaoyumuxi
added a commit
to 1lck/Lithe-IDEA
that referenced
this pull request
Nov 17, 2026
* feat(desktop): 引用工具窗口对齐 IDEA 查找用法 - 结果按 用法 → 文件 → 用法 三层树展示,文件行带目录和用法数,用法行带行号并加粗命中词 - 右侧预览选中用法所在文件,标出全部用法并选中当前用法,可用分隔条调整宽度、工具栏开关 - 左侧竖排工具栏:重新查找、上一个/下一个用法、全部展开/折叠、显示预览 - 标题栏增加搜索标签(符号名 + 关闭),关闭即清空结果并收起工具窗口 - 抽出 previewAroundRanges 供搜索和引用共用;新增中英词条 * refactor(desktop): Problems 预览改用共享的 sourcePreview,并更新引用面板功能矩阵 - problems_preview.go 原有一份与 source_preview.go 逐行重复的只读预览(加载、安装、绘制),改为调用 showSourcePreview / sourcePreviewPane,只保留取选中诊断的逻辑 - 新增 TestProblemsPreviewFollowsTheSelectedDiagnostic 覆盖预览跟随选中诊断、不打开编辑器、读不到文件时显示原因 - references-pane 功能矩阵补充 IDEA 式布局说明与证据;新增改动前后截图 * refactor(desktop): 引用结果的分组、树行、步进和行预览改由 Core 计算,右键菜单改名查找用法 - 新增 core.ReferencesQuery / ReferencesLines,桥接 Core 的 lsp.references.query、 lsp.references.lines;桌面端删掉 Go 里的分组排序、可见行投影、选中转移、 上一个/下一个用法和行裁剪,只保留折叠状态、选中键、读文件与绘制 - 文件分组改为项目视图的自然文件名顺序;用法行文本在后台由 Core 裁剪后回填 - workspace.search 返回 previewRanges,查找结果和随处搜索不再各自裁剪行 - 编辑器右键菜单“查找引用”改为“查找用法”(仍是 Shift+F12),右键点在选区外 时查的是被点的词,补单元测试 - PINNED_CORE_REVISION 固定 Core #80 分支提交 81a6ecf,合入后改为 main 的合并提交 - 更新 references-pane 功能矩阵 Refs #2096, Lithe-IDEA/Lithe-core-rust#80 * test(desktop): 引用截图测试补编辑器右键菜单的查找用法 在 TestVisualReferencesToolWindow 里右键点 absSelf,截取编辑器菜单(查找用法 Shift+F12), 提交深色中文和浅色英文两张;功能矩阵记录这项无头截图。 Refs #2096
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
类型
feat:新增 Core 命令
lsp.references.query、lsp.references.lines;workspace.search的内容匹配多返回previewRanges改动
桌面端的 References 工具窗口(对齐 IDEA 查找用法)原来在 Go 里自己做分组、排序、树行投影、选中转移、上一个/下一个用法和行预览裁剪;搜索结果和随处搜索也各有一份裁剪行的代码。本 PR 把这些规则放进 Core,宿主只保留折叠状态、选中键、读取文件和绘制。
lsp.references.query{locations:[{fileKey,displayPath,line,column}], rootCollapsed?, collapsed?:[fileKey], selected?}{groups:[{key,fileKey,displayPath,name,folder,indices}], rows:[{key,kind,depth,expanded?,group?,shows,previous?,next?}], selected?, selectedRow?}lsp.references.lines{texts:[string], usages:[{text,line,column,endLine,endColumn}]}{lines:[{text,ranges}]}规则(
rust/crates/lsp-policy/src/references.rs):root、file:<fileKey>、usage:<index>。rows只含可见行;每行的shows是选中该行时预览的用法,previous/next是按树顺序的前后用法,不循环,跨越折叠的节点。selected/selectedRow给出结果;没有位置时两者都不返回。lsp.references.lines和搜索结果用同一套行预览规则(rust/crates/text/src/line_preview.rs):去掉缩进和换行;用法离行首较远时,从前面截断并加省略号;最多 240 字节;按 UTF-16 返回高亮范围。相同的文本只需传一次,用法通过text索引引用。workspace.search带includeContentRanges时,内容匹配的preview也用line_preview生成,并新增previewRanges,宿主的查找结果和随处搜索不再各自裁剪。文档:
rust/contracts/rust-core-api.md写入两个命令和previewRanges。Fixture:新增
rust/fixtures/lsp/references-query-v1.json、rust/fixtures/lsp/references-lines-v1.json,rust/fixtures/search/text-snapshot-v1.json补previewRanges。宿主的桥接测试直接读这两份 fixture,经真实 Core 比对。插件契约:没有改
shared/plugins/、能力版本或plugin-rpc,不需要更新协议更新记录,也不需要宿主方法表。这两个命令不标记为热路径请求。验证
cargo test --locked -p lithe-core -- lsp_policy projectcargo test --locked -p lithe-lsp-policy -p lithe-text -p lithe-projectcargo clippy --locked -p lithe-lsp-policy -p lithe-text -p lithe-project -p lithe-core --all-targets -- -D warnings、cargo fmt --all -- --checkscripts/rust-core/verify-rust-core-comments.sh(lsp-policy、text、project、core)node scripts/rust-core/verify-platform-tests.mjsnode shared/plugins/scripts/verify-docs.mjsgo test ./internal/core/ ./internal/workbench/(链接本分支)后续
PINNED_CORE_REVISION升到合并提交。