Repository navigation
feat(editor): 复制代码引用(同步最新 main,替代 #2043) - #2046
Merged
xiaoyumuxi merged 8 commits intoNov 17, 2026
Merged
Conversation
…n, preserving toolchain Core changes
17 of 22 tasks
…015-copy-reference-main-sync # Conflicts: # scripts/desktop/build-desktop-core.sh
符号回复到达时文档已改或已关,原来只清 pending 不清请求本身,过期请求一直挂着; 现在同时清掉,测试断言它不再残留。删掉 TestCopyReferenceLocationUsesLanguageSymbols 里排查用的 t.Cleanup 日志。
xiaoyumuxi
marked this pull request as ready for review
November 17, 2026 05:21
xiaoyumuxi
requested review from
1lck,
Mucheen and
xiaoyumuxi
as code owners
November 17, 2026 05:21
…015-copy-reference-main-sync
- 语言服务器一直不回答时,最多等 3 秒(referenceSymbolsTimeout),之后取消请求、 记录 editor_copy_reference_symbols 日志,按没有服务器时的规则复制文件路径和行号; 回答到达或被新一次复制替换时停止计时。 - 右键坐标只属于它打开的那一次菜单:菜单画出后没选这一项就关闭,坐标丢弃, 之后 Shift+F10 打开的菜单读取光标位置。 - 新增两个回归测试,修复前失败、修复后通过;更新 Agent Note 与功能矩阵说明, 矩阵备注不再写 Core PR 待配套合入。
…015-copy-reference-main-sync
xiaoyumuxi
deleted the
lithe-support/issue-2015-copy-reference-main-sync
branch
November 20, 2026 01:35
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 / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
编辑器右键菜单原来没有复制当前代码引用的入口。#2015 希望右键得到
com.example.DemoClass#goHome(String,Integer)#L137这样带包、类、方法签名和行号的引用;拿不到符号时退回文件路径#L137。Core #70(已合入 Core main6a29169)提供通用的引用格式化命令editor.copyReferenceLocation,本 PR 把它接入 macOS 和 Windows 共用的 Viva 编辑器。改动 / Changes
native.copySourceLocation(editor_menu.go);editor_view.go的documentPointer记下右键坐标)。copy_reference.go):documentSymbols;editor.copyReferenceLocation生成,宿主只写系统剪贴板;desktop/internal/core/reference_location.go:新增 Core 命令的 JSON 桥接(ReferenceLocationRequest、CopyReferenceLocation)。editor_requests.go、pluginsemantics.go:copyReferenceSymbols请求类型,发出的是documentSymbols操作,回答路由到applyReferenceSymbols;scripts/desktop/build-desktop-core.sh:固定版本升到 Core main6a29169,也就是 lithe 0.2.1 #70 squash 合入后的 main,下面是 docs: add v0.2.2 release notes #73(c928514)和 [Feature] Windows 多会话终端与 Git 体验完善 #77(0d6e16c)。上一轮固定的 lithe 0.2.1 #70 分支d720cc9到这个提交,只多了 docs: add v0.2.2 release notes #73 的indexing.rs;main 原来固定的 docs: add v0.2.2 release notes #73 分支10fd6f8到这个提交,只多了 lithe 0.2.1 #70 的文件。copy_reference_test.go;copy_reference_visual_test.go:深色/浅色 × 中文/英文,截右键菜单和真实粘贴结果;editor-copy-reference-location.json;2026-11-16-copy-editor-reference-location.md。semanticStartTimeout限时,但回答没有期限。服务器在索引或卡住时,点了菜单项剪贴板一直不变,也没有提示。现在最多等 3 秒(referenceSymbolsTimeout),超时后记录editor_copy_reference_symbols日志、取消请求,然后按没有服务器时的规则复制文件路径#L行号。回答提前到达或请求被新一次复制替换时,计时器停止。referenceMenuPainted)。main,解决 Core 固定版本冲突,改为固定上面的 Core main6a29169。t.Cleanup日志。不在本 PR 范围内 / Out of scope
.和#由 Core lithe 0.2.1 #70 决定,是 IDEA/Java 的写法。其他语言的引用格式要改的话,在 Core 里改。类型专属:feat
多平台对齐
platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/editor-copy-reference-location.json:两端都是implemented,验证状态都是pending(原生验收没做);本轮在验证说明里补上了超时回退和右键菜单关闭后的行为。generate-platform-feature-matrix.mjs --check(196 项通过)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(通过)。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
documentSymbols事件。newSemanticFixture,插件 IDtest)和临时目录。documentSymbols请求。UI 验证 / UI evidence
TestVisualCopyReferenceLocation(深色/浅色 × 中文/英文),8 张截图人工看过:菜单里有“复制源码位置”;光标在第 5 行、右键点在文末空白处,粘贴结果是…/DemoClass.java#L8,说明用的是右键位置(测试没有语言服务器,所以是路径回退)。统一日志系统 / Structured logging
performed(菜单操作)、backgroundFailed(符号解析失败、本轮新增的符号超时)、operationFailed(Core 调用失败、剪贴板失败);没有新增事件 ID。界面文案 / i18n
native.copySourceLocation,没有新增词条,也没有改生成文件。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:没有设置变化。
插件契约 / Plugin contract
N/A:不改插件契约、宿主方法或通知;
editor.copyReferenceLocation是 Core 的编辑器命令,由 Core #70 新增,不属于插件契约。发行包与资源 / Bundle and resources
.artifacts;已运行./scripts/desktop/verify/verify-runtime-bundle-immutability.sh(通过)。无用代码与重构 / Dead code and refactoring
验证 / Verification
6a29169TestCopyReferenceLocationFallsBackWhenSymbolsNeverArrive等待“file and line copied without symbols”超时,剪贴板没有内容;TestEditorContextMenuForgetsPressAfterItCloses等待“caret line copied”超时,复制的是 Esc 前右键的那一行desktop-go.sh test ./internal/workbench -run 'CopyReference|EditorContextMenu' -count=1 -v6a29169desktop-go.sh test ./internal/workbench ./internal/core -count=1(整包)6a29169settingswindow包,通过desktop-go.sh vet ./internal/workbench、gofmt -l./scripts/agent-notes/verify-agent-notes.shgenerate-platform-feature-matrix.mjs --check、verify-platform-feature-matrix-change.sh origin/main HEADnode scripts/i18n/generate-i18n.mjs --check、verify-app-language-localization.mjsverify-runtime-bundle-immutability.shLITHE_VISUAL_OUTPUT_DIR=.artifacts/issue-2015 desktop-go.sh test -tags 'vivahead lithevisual' ./internal/workbench -run '^TestVisualCopyReferenceLocation$'desktop/internal/workbench/.artifacts/issue-2015)未能执行的检查和原因:
pending。提交前确认 / Final checks
main创建,已合并最新main;目标分支main。