From 0032eb98a31db4a0b6c19bffe851551ee9af966b Mon Sep 17 00:00:00 2001 From: "lithe-support[bot]" <356900028+lithe-support[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:37:14 +0000 Subject: [PATCH 1/5] feat(editor): port #2015 Viva copy-reference feature onto current main, preserving toolchain Core changes --- ...26-11-16-copy-editor-reference-location.md | 40 ++++++ desktop/internal/core/reference_location.go | 29 ++++ desktop/internal/workbench/copy_reference.go | 130 ++++++++++++++++++ .../internal/workbench/copy_reference_test.go | 106 ++++++++++++++ .../workbench/copy_reference_visual_test.go | 113 +++++++++++++++ desktop/internal/workbench/editor_features.go | 13 +- desktop/internal/workbench/editor_menu.go | 4 + desktop/internal/workbench/editor_requests.go | 6 + desktop/internal/workbench/editor_view.go | 5 + desktop/internal/workbench/pluginsemantics.go | 5 +- scripts/desktop/build-desktop-core.sh | 2 +- .../editor-copy-reference-location.json | 31 +++++ 12 files changed, 476 insertions(+), 8 deletions(-) create mode 100644 .agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md create mode 100644 desktop/internal/core/reference_location.go create mode 100644 desktop/internal/workbench/copy_reference.go create mode 100644 desktop/internal/workbench/copy_reference_test.go create mode 100644 desktop/internal/workbench/copy_reference_visual_test.go create mode 100644 shared/platform-feature-matrix/features/editor-copy-reference-location.json diff --git a/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md b/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md new file mode 100644 index 0000000000..a8a48ae9b9 --- /dev/null +++ b/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md @@ -0,0 +1,40 @@ +# Agent 笔记:编辑器复制代码引用位置 + +状态:已实现 + +## 先说结论 + +Viva 编辑器的右键菜单提供复制源码位置,默认把所点行复制到剪贴板。有语言服务器同步提供的文档符号时,Rust Core 把包、类、方法及原始签名组成引用;没有可靠符号时只复制文件路径和行号,不推测源码。macOS 与 Windows 共用实现,避免两端产生不同格式。 + +## 问题 + +#2015 需要从编辑器快速得到方法引用及行号。原有标签页“复制路径/引用”只处理文件路径;从文件名和源码文本自己猜方法签名会在重载方法、嵌套类和未保存编辑时产生错误引用。 + +## 决策 + +- 使用语言服务器协议(LSP)的 `documentSymbols`:先确认当前文档已同步,随后由现有异步请求链获取符号;优先使用与文档修订相同的 Structure 缓存。 +- 桌面端只捕获右键坐标、管理请求生命周期并写入系统剪贴板;格式规则属于 Rust Core 的 `editor.copyReferenceLocation`。 +- Core 只消费上游提供的符号名称、类型、作用域及方法签名,没有可靠信息就按 `文件路径#L行号` 回退。用户看到的一基行号由 Core 统一处理。 +- 旧文档或项目、关闭的标签、后续编辑以及新一次复制都不能接收过期操作。插件会话失败与缺少符号不阻断文件路径回退。 +- 菜单复用现有共享 i18n 的“复制源码位置”(`native.copySourceLocation`),而不是在桌面端增加无法生成的硬编码界面文案。 + +## 考虑过的备选方案 + +- **直接解析 Java 源文件提取类/方法**:不采用。需要为每门语言维护解析规则,还会误识别重载方法与泛型,违反 Core 不特判语言的约束。 +- **直接复制文件行号,不请求 LSP**:只作为缺失服务器的回退;否则无法实现 Issue 要求的符号级引用。 +- **把格式规则写入 Go/Viva**:不采用。相同功能在两个平台的语义必须由共享 Core 定义。 + +## 后果 + +右键复制不启动新的常驻服务,也不阻塞编辑器线程。符号质量取决于语言服务器提供的名字与签名;有些服务器不提供包名或方法参数时,输出会相应变短。未保存修改尚未完成 LSP 同步时,优先保证位置正确并回退文件路径,不能拿旧符号当新信息。 + +## 验证 + +- Core: `cargo test -p lithe-editor`;`cargo test -p lithe-core copy_reference_location`。 +- Viva: `scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestCopyReferenceLocation|TestEditorContextMenuCopiesReference' -count=1`。 +- 视觉: `LITHE_VISUAL_OUTPUT_DIR=.artifacts/issue-2015 scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/workbench -run '^TestVisualCopyReferenceLocation$' -count=1`。 +- 两个平台原生集成与粘贴结果仍需实际执行,不能以静态源代码检查替代。 + +## 适用范围 + +`desktop/internal/workbench/copy_reference.go`、`desktop/internal/workbench/editor_menu.go`、`desktop/internal/core/reference_location.go`、`rust/crates/editor/src/reference_location.rs`、`rust/contracts/rust-core-api.md`。 diff --git a/desktop/internal/core/reference_location.go b/desktop/internal/core/reference_location.go new file mode 100644 index 0000000000..ab880deafb --- /dev/null +++ b/desktop/internal/core/reference_location.go @@ -0,0 +1,29 @@ +package core + +import "context" + +// ReferenceLocationRequest is a snapshot of the requested caret and the LSP +// symbols synchronized to that document revision. Coordinates are zero-based +// UTF-16 positions, while the result's human-readable line is one-based. +type ReferenceLocationRequest struct { + Path string `json:"path"` + Line int `json:"line"` + UTF16Column int `json:"utf16Column"` + Symbols []DocumentSymbol `json:"symbols"` +} + +type ReferenceLocationResult struct { + Reference string `json:"reference"` + Source string `json:"source"` +} + +// CopyReferenceLocation uses the shared Rust Core formatter. The desktop host +// does not interpret package, type, method names or signature conventions. +func (c *Client) CopyReferenceLocation(ctx context.Context, request ReferenceLocationRequest) (ReferenceLocationResult, error) { + if request.Symbols == nil { + request.Symbols = []DocumentSymbol{} + } + var result ReferenceLocationResult + err := c.Execute(ctx, "editor.copyReferenceLocation", request, &result) + return result, err +} diff --git a/desktop/internal/workbench/copy_reference.go b/desktop/internal/workbench/copy_reference.go new file mode 100644 index 0000000000..d8090b225d --- /dev/null +++ b/desktop/internal/workbench/copy_reference.go @@ -0,0 +1,130 @@ +package workbench + +import ( + "context" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/vivaui/viva/app" +) + +// A secondary press chooses the line under the pointer, not the previous +// keyboard caret. The context-menu item consumes the coordinate after the +// popup closes; each operation owns a revision and an identity token. +type referenceClick struct { + documentID int + line, column int +} + +type referenceRequest struct { + project *project + documentID, revision int + line, column int + path string + pending *semanticPending +} + +type copyReferenceState struct { + click *referenceClick + request *referenceRequest +} + +type referenceKernel interface { + CopyReferenceLocation(context.Context, core.ReferenceLocationRequest) (core.ReferenceLocationResult, error) +} + +func (a *App) copyReferenceLocation(p *project, d *document) { + if p == nil || d == nil || d.virtual || d.path == "" || a.project != p { + return + } + kernel, ok := a.kernel.(referenceKernel) + if !ok { + return + } + a.performed("editor.copyReferenceLocation", surfaceContextMenu) + line, column := d.view.CaretUTF16() + if click := a.editor.copyReference.click; click != nil && click.documentID == d.id { + line, column = click.line, click.column + } + a.editor.copyReference.click = nil + if previous := a.editor.copyReference.request; previous != nil && previous.pending != nil { + a.cancelSemantic(previous.pending) + } + request := &referenceRequest{ + project: p, documentID: d.id, revision: d.view.Revision(), + line: line, column: column, path: d.path, + } + a.editor.copyReference.request = request + + // A loaded Structure result can be used only for exactly this document + // revision. Otherwise ask the same LSP documentSymbols feature directly; + // never use a stale tree from a previous document or unsaved edit. + outline := &a.editor.outline + if outline.project == p && outline.documentID == d.id && outline.loaded && + outline.revision == request.revision { + a.finishReferenceLocation(request, outline.symbols, kernel) + return + } + server, offered := a.editorServer(d, featureDocumentSymbols) + if offered && server != nil && a.semanticDocumentReady(d) { + request.pending = a.submitEditorRequest(pluginSemanticCopyReference, p, d, server, core.PluginSemanticRequest{}) + return + } + // An unavailable or unsynchronized language server does not block copying: + // the shared Core produces a path reference instead of guessing symbols. + a.finishReferenceLocation(request, nil, kernel) +} + +// applyReferenceSymbols is reached through the ordinary semantic event router. +// Failed, unsupported or malformed symbols retain a useful file/line fallback. +func (a *App) applyReferenceSymbols(pending *semanticPending, event core.BackendEvent, failed bool) { + request := a.editor.copyReference.request + if request == nil || request.pending != pending { + return + } + request.pending = nil + p, d := a.currentSemanticDocument(request.documentID) + if p != request.project || d == nil || d.view.Revision() != request.revision { + return + } + var symbols []core.DocumentSymbol + if !failed { + var err error + symbols, err = core.PluginDocumentSymbols(event) + if err != nil { + a.backgroundFailed("editor_copy_reference_symbols", err) + } + } + if kernel, ok := a.kernel.(referenceKernel); ok { + a.finishReferenceLocation(request, symbols, kernel) + } +} + +func (a *App) finishReferenceLocation(request *referenceRequest, symbols []core.DocumentSymbol, kernel referenceKernel) { + a.background(request.project, kernelCallTimeout, func(ctx context.Context) func(*App) { + result, err := kernel.CopyReferenceLocation(ctx, core.ReferenceLocationRequest{ + Path: request.path, Line: request.line, UTF16Column: request.column, Symbols: symbols, + }) + return func(a *App) { + if a.editor.copyReference.request != request || a.project != request.project { + return + } + d := request.project.docs.find(request.documentID) + if d == nil || d.view.Revision() != request.revision || + request.project.selectedDocument(request.project.docs.group) != d { + a.editor.copyReference.request = nil + return + } + a.editor.copyReference.request = nil + if err != nil { + a.operationFailed("editor_copy_reference", err) + a.notifyError(a.text.Errors.Core(err.Error())) + return + } + if err := app.SetClipboardText(result.Reference); err != nil { + a.operationFailed("clipboard_copy", err) + a.notifyError(i18n.SharedFormat(a.language(), "desktop.files.copyFailed", map[string]string{"reason": err.Error()})) + } + } + }) +} diff --git a/desktop/internal/workbench/copy_reference_test.go b/desktop/internal/workbench/copy_reference_test.go new file mode 100644 index 0000000000..8e9172f6f4 --- /dev/null +++ b/desktop/internal/workbench/copy_reference_test.go @@ -0,0 +1,106 @@ +package workbench + +import ( + "os" + "path/filepath" + "strconv" + "strings" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" +) + +func TestCopyReferenceLocationWithoutServerCopiesFileLine(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + root := t.TempDir() + h.open(root) + path := filepath.Join(root, "reference.go") + if err := os.WriteFile(path, []byte("package main\nfunc work() {}\n"), 0600); err != nil { + t.Fatal(err) + } + p := h.app.project + h.app.openFile(p, path) + h.settleChain() + d := p.docs.byPath(path) + if d == nil { + t.Fatal("document not opened") + } + d.view.GoToLine(2) + h.app.copyReferenceLocation(p, d) + h.await("copy file and line", func() bool { + return h.driver.Clipboard() == path+"#L2" + }) +} + +func TestCopyReferenceLocationUsesLanguageSymbols(t *testing.T) { + f := newSemanticFixture(t) + f.server.features = map[string]bool{featureDocumentSymbols: true} + f.d.view.SetSelection(0, 0) + f.h.app.copyReferenceLocation(f.p, f.d) + f.h.await("reference symbol request submitted", func() bool { + req := f.h.app.editor.copyReference.request + return req != nil && req.pending != nil && req.pending.operation != "" + }) + pending := f.h.app.editor.copyReference.request.pending + f.deliver(t, pending.operation, pluginMethodDocumentSymbols, symbolsResult(t, + symbolAt("DemoClass", 5, 0, 1, + symbolAt("goHome(String,Integer)", 6, 0, 1)), + )) + t.Cleanup(func() { + req := f.h.app.editor.copyReference.request + t.Logf("reference diagnostics: clipboard=%q pendingRequest=%v activeGroup=%q docGroup=%q selected=%p expectedDoc=%p", f.h.driver.Clipboard(), req != nil, f.p.docs.group, f.d.group, f.p.selectedDocument(f.p.docs.group), f.d) + }) + f.h.await("symbol reference request settled", func() bool { + return f.h.app.editor.copyReference.request == nil + }) + if got := f.h.driver.Clipboard(); got != "DemoClass#goHome(String,Integer)#L1" { + t.Fatalf("copied %q, want method reference", got) + } +} + +func TestCopyReferenceLocationDiscardsOldDocumentRevision(t *testing.T) { + f := newSemanticFixture(t) + f.server.features = map[string]bool{featureDocumentSymbols: true} + f.h.app.copyReferenceLocation(f.p, f.d) + f.h.await("stale-reference symbol request submitted", func() bool { + req := f.h.app.editor.copyReference.request + return req != nil && req.pending != nil && req.pending.operation != "" + }) + pending := f.h.app.editor.copyReference.request.pending + f.h.app.insertForTest(f.d, "changed") + f.deliver(t, pending.operation, pluginMethodDocumentSymbols, symbolsResult(t, + symbolAt("Outdated", 5, 0, 1), + )) + f.h.settleChain() + if got := f.h.driver.Clipboard(); strings.Contains(got, "Outdated") { + t.Fatalf("stale reference copied: %q", got) + } +} + +func TestEditorContextMenuCopiesReferenceAtSecondaryPress(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + root := t.TempDir() + h.open(root) + path := filepath.Join(root, "reference.txt") + if err := os.WriteFile(path, []byte("one\ntwo\nthree\n"), 0600); err != nil { + t.Fatal(err) + } + p := h.app.project + h.app.openFile(p, path) + h.settleChain() + d := p.docs.byPath(path) + if d == nil { + t.Fatal("document missing") + } + bounds := h.topHit(d.hit) + at := center(bounds) + line, _, ok := d.view.PositionAt(at.X, at.Y) + if !ok { + t.Fatal("editor has not painted") + } + h.rightClickAt(bounds) + h.clickNamed(h.shared("native.copySourceLocation")) + h.await("right-click location copied", func() bool { + return h.driver.Clipboard() == path+"#L"+strconv.Itoa(line+1) + }) +} diff --git a/desktop/internal/workbench/copy_reference_visual_test.go b/desktop/internal/workbench/copy_reference_visual_test.go new file mode 100644 index 0000000000..489588a37c --- /dev/null +++ b/desktop/internal/workbench/copy_reference_visual_test.go @@ -0,0 +1,113 @@ +//go:build vivahead && lithevisual + +package workbench + +import ( + "os" + "path/filepath" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/store" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/headless" +) + +// TestVisualCopyReferenceLocation captures the actual editor's secondary-click +// menu and the result pasted into an editor via the primary+V shortcut. +// Dark/light x Chinese/English are independent sessions and OS-free. +func TestVisualCopyReferenceLocation(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR") + } + if err := os.MkdirAll(out, 0755); err != nil { + t.Fatal(err) + } + for _, look := range []struct{ theme, language string }{ + {"dark", "zh-Hans"}, {"dark", "en"}, + {"light", "zh-Hans"}, {"light", "en"}, + } { + t.Run(look.theme+"-"+look.language, func(t *testing.T) { + prefs := store.At(t.TempDir()) + if err := prefs.Save(settingsFile, settings{ + Theme: themeChoice(look.theme), Language: look.language, + DisableAutoSave: true, + }); err != nil { + t.Fatal(err) + } + root := filepath.Join(t.TempDir(), "ReferenceDemo") + if err := os.MkdirAll(root, 0700); err != nil { + t.Fatal(err) + } + path := filepath.Join(root, "DemoClass.java") + source := "package com.example;\n\npublic class DemoClass {\n void goHome(String city, Integer count) {\n System.out.println(city);\n }\n}\n" + if err := os.WriteFile(path, []byte(source), 0600); err != nil { + t.Fatal(err) + } + var session *headless.Session + h := newHarnessWithDriver(t, Options{ + Kernel: &testKernel{Client: core.NewClient()}, + Store: prefs, Languages: []string{look.language}, + }, func(config app.Config) (*app.Driver, func(), error) { + config.Width, config.Height = 1440, 900 + var err error + session, err = headless.Open(config, nil, headless.Options{}) + if err != nil { + return nil, nil, err + } + return session.Driver(), session.Close, nil + }) + h.open(root) + p := h.app.project + h.app.openFile(p, path) + h.settleChain() + d := p.docs.byPath(path) + if d == nil { + t.Fatal("editor not opened") + } + d.view.GoToLine(5) + h.app.focusDocument(d.id) + h.settleChain() + h.rightClickAt(h.topHit(d.hit)) + if !h.shows(h.shared("native.copySourceLocation")) { + t.Fatal("reference copy action missing from context menu") + } + if err := session.Screenshot(filepath.Join(out, "reference-menu-"+look.theme+"-"+look.language+".png")); err != nil { + t.Fatal(err) + } + // PositionAt the secondary press controls the reference's line, not + // the caret set above. Copying a plain file is a valid fallback. + h.clickNamed(h.shared("native.copySourceLocation")) + h.await("reference on clipboard", func() bool { + return len(h.driver.Clipboard()) >= len(path)+3 && h.driver.Clipboard()[:len(path)+2] == path+"#L" + }) + reference := h.driver.Clipboard() + if reference[:len(path)] != path || reference[len(path):len(path)+2] != "#L" { + t.Fatalf("unexpected clipboard reference %q", reference) + } + resultPath := filepath.Join(root, "pasted-result.txt") + if err := os.WriteFile(resultPath, []byte(""), 0600); err != nil { + t.Fatal(err) + } + h.app.openFile(p, resultPath) + h.settleChain() + resultDoc := p.docs.byPath(resultPath) + if resultDoc == nil { + t.Fatal("result editor not opened") + } + h.app.focusDocument(resultDoc.id) + h.settleChain() + handled, err := h.driver.ShortcutChord(primaryModifier(), 'v') + if err != nil || !handled { + t.Fatalf("clipboard paste shortcut handled=%v error=%v", handled, err) + } + h.await("paste result appears", func() bool { + return resultDoc.view.TextSnapshot().String() == reference + }) + if err := session.Screenshot(filepath.Join(out, "reference-pasted-"+look.theme+"-"+look.language+".png")); err != nil { + t.Fatal(err) + } + }) + } +} diff --git a/desktop/internal/workbench/editor_features.go b/desktop/internal/workbench/editor_features.go index a28c3cae81..a77265031e 100644 --- a/desktop/internal/workbench/editor_features.go +++ b/desktop/internal/workbench/editor_features.go @@ -6,10 +6,11 @@ package workbench type editorFeatures struct { nav navigationHistoryState // requests counts the editor's own language requests, which name them (editor_requests.go). - requests uint64 - outline outlineState - refs referencesState - encoding encodingState - lsp lspLogState - tokens semanticTokensState + requests uint64 + outline outlineState + copyReference copyReferenceState + refs referencesState + encoding encodingState + lsp lspLogState + tokens semanticTokensState } diff --git a/desktop/internal/workbench/editor_menu.go b/desktop/internal/workbench/editor_menu.go index e952b8b440..16c2e56aae 100644 --- a/desktop/internal/workbench/editor_menu.go +++ b/desktop/internal/workbench/editor_menu.go @@ -49,6 +49,10 @@ func (a *App) editorMenuItems(c ui.C, p *project, d *document) func(*ui.MenuItem } } menu.Separator() + if menu.Item(i18n.Shared(language, "native.copySourceLocation")).Clicked() { + c.After(func() { a.copyReferenceLocation(p, d) }) + } + menu.Separator() if menu.Item(i18n.Shared(language, "desktop.editorMenu.toggleComment")).Keys(primary, "/").Disabled(readOnly).Clicked() { c.After(func() { a.runLineOperation(p, d, core.ToggleLineComment) }) } diff --git a/desktop/internal/workbench/editor_requests.go b/desktop/internal/workbench/editor_requests.go index d1d35a928c..d414c97430 100644 --- a/desktop/internal/workbench/editor_requests.go +++ b/desktop/internal/workbench/editor_requests.go @@ -16,6 +16,7 @@ const ( // pluginSemanticDocumentSymbols and pluginSemanticTokens are the operations of the // outline and the semantic colors; their methods are what Core reports on completion. pluginSemanticDocumentSymbols = "documentSymbols" + pluginSemanticCopyReference = "copyReferenceSymbols" pluginSemanticTokens = "semanticTokens" pluginMethodDocumentSymbols = "textDocument/documentSymbol" pluginMethodSemanticTokens = "textDocument/semanticTokens/full" @@ -56,6 +57,9 @@ func (a *App) submitEditorRequest(kind semanticKind, p *project, d *document, se } a.semantics.pending = append(a.semantics.pending, pending) request.Operation, request.URI = string(kind), d.sync.uri + if kind == pluginSemanticCopyReference { + request.Operation = pluginSemanticDocumentSymbols + } a.background(p, semanticStartTimeout, func(ctx context.Context) func(*App) { operation, err := a.plugins.RequestLanguageSession(ctx, server.session, request) return func(a *App) { a.semanticRequestStarted(pending, operation, err, ctx.Err()) } @@ -74,6 +78,8 @@ func (a *App) applyEditorEvent(pending *semanticPending, event core.BackendEvent switch pending.kind { case pluginSemanticDocumentSymbols: a.applyOutline(pending, event, failed) + case pluginSemanticCopyReference: + a.applyReferenceSymbols(pending, event, failed) case pluginSemanticTokens: a.applySemanticTokens(pending, event, failed) case pluginSemanticFoldingRanges: diff --git a/desktop/internal/workbench/editor_view.go b/desktop/internal/workbench/editor_view.go index d0988e343a..17d208210c 100644 --- a/desktop/internal/workbench/editor_view.go +++ b/desktop/internal/workbench/editor_view.go @@ -257,6 +257,11 @@ func (a *App) documentKey(p *project, d *document, event gfx.KeyEvent) gfx.Event // editor: the press on a text and the moves and the release of the selection it starts, // wherever they go. func (a *App) documentPointer(p *project, d *document, event gfx.PointerEvent) gfx.EventResult { + if event.Kind == gfx.PointerDown && event.Button == gfx.PointerButtonSecondary { + if line, column, ok := d.view.PositionAt(event.X, event.Y); ok { + a.editor.copyReference.click = &referenceClick{documentID: d.id, line: line, column: column} + } + } // A semantic popup or request belongs to the caret and symbol it was opened at; any // pointer work that moved either closes it before the frame paints. defer a.pluginSemanticsCaretSync() diff --git a/desktop/internal/workbench/pluginsemantics.go b/desktop/internal/workbench/pluginsemantics.go index 5db8717d34..c11253100d 100644 --- a/desktop/internal/workbench/pluginsemantics.go +++ b/desktop/internal/workbench/pluginsemantics.go @@ -110,7 +110,7 @@ func (k semanticKind) method() string { return pluginMethodRangeFormatting case pluginSemanticRename: return pluginMethodRename - case pluginSemanticDocumentSymbols: + case pluginSemanticDocumentSymbols, pluginSemanticCopyReference: return pluginMethodDocumentSymbols case pluginSemanticTokens: return pluginMethodSemanticTokens @@ -882,6 +882,9 @@ func (a *App) semanticRequestStarted(pending *semanticPending, operation string, if err != nil { a.removePending(pending) a.settleMergeSide(pending.join, true, nil, false) + if pending.kind == pluginSemanticCopyReference { + a.applyReferenceSymbols(pending, core.BackendEvent{}, true) + } if errors.Is(err, context.Canceled) || errors.Is(ctxErr, context.Canceled) { return } diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 5ca79b2097..8d1abf8088 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -150,7 +150,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="5a8d786e9b44a5a8c7a977a8b376264fa941dcd9" +PINNED_CORE_REVISION="d00bc9f1257d91a2e6c73cd6322c2f5870daacb9" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/shared/platform-feature-matrix/features/editor-copy-reference-location.json b/shared/platform-feature-matrix/features/editor-copy-reference-location.json new file mode 100644 index 0000000000..1aed9f925b --- /dev/null +++ b/shared/platform-feature-matrix/features/editor-copy-reference-location.json @@ -0,0 +1,31 @@ +{ + "id": "editor-copy-reference-location", + "area": "编辑器", + "group": "导航", + "capability": "从编辑器右键菜单复制符号与代码行引用", + "macos": { + "implementationStatus": "implemented", + "verificationStatus": "pending", + "evidence": [ + "desktop/internal/workbench/copy_reference.go", + "desktop/internal/workbench/editor_menu.go", + "desktop/internal/workbench/copy_reference_test.go", + "desktop/internal/core/reference_location.go", + "desktop/internal/workbench/copy_reference_visual_test.go" + ] + }, + "windows": { + "implementationStatus": "implemented", + "verificationStatus": "pending", + "evidence": [ + "desktop/internal/workbench/copy_reference.go", + "desktop/internal/workbench/editor_menu.go", + "desktop/internal/workbench/copy_reference_test.go", + "desktop/internal/core/reference_location.go", + "desktop/internal/workbench/copy_reference_visual_test.go" + ] + }, + "owner": "Editor", + "notes": "通过 Viva 共用菜单复制右键所在行的引用;Rust Core 负责从同步的 documentSymbols 生成包/类/方法签名引用,没有可靠符号时回退为文件路径与行号。菜单复用现有“复制源码位置”中英文词条;Core 与桌面修复 PR 需配套合入。", + "verification": "Core 共享 fixture 和 Rust 单测;Viva Go 测试覆盖菜单、剪贴板、语言服务器回复、无服务器回退和过期结果。双端原生验收、视觉截图待运行。 Viva Headless 测试定义在 copy_reference_visual_test.go,执行后输出四组菜单与真实粘贴截图。" +} From 4d32bd9146ca81202ebcc051eb8df65ce11d7dd2 Mon Sep 17 00:00:00 2001 From: "lithe-support[bot]" <356900028+lithe-support[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:45:56 +0000 Subject: [PATCH 2/5] fix(editor): pin integrated Core with nullable symbol children support (#2015) --- scripts/desktop/build-desktop-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 8d1abf8088..13170b6223 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -150,7 +150,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="d00bc9f1257d91a2e6c73cd6322c2f5870daacb9" +PINNED_CORE_REVISION="16c3bcdd04d62a935d48de8d59908da123410c31" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in From 95c46a0916b873d006057e7e00ed8f39658718f2 Mon Sep 17 00:00:00 2001 From: "lithe-support[bot]" <356900028+lithe-support[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:49:02 +0000 Subject: [PATCH 3/5] chore(editor): pin formatted Core integration SHA for #2015 --- scripts/desktop/build-desktop-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 13170b6223..d82f87ec7f 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -150,7 +150,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="16c3bcdd04d62a935d48de8d59908da123410c31" +PINNED_CORE_REVISION="0b8c462dc43d46538fc15b13070969cec6143015" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in From dded85353a2c3ab78c4ee960dfb20cc74bedb578 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 17 Nov 2026 12:48:57 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix(editor):=20=E5=A4=8D=E5=88=B6=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E4=BD=8D=E7=BD=AE=E5=9C=A8=E6=96=87=E6=A1=A3=E5=B7=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E6=B8=85=E6=8E=89=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97=20(#2015?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 符号回复到达时文档已改或已关,原来只清 pending 不清请求本身,过期请求一直挂着; 现在同时清掉,测试断言它不再残留。删掉 TestCopyReferenceLocationUsesLanguageSymbols 里排查用的 t.Cleanup 日志。 --- desktop/internal/workbench/copy_reference.go | 2 ++ desktop/internal/workbench/copy_reference_test.go | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/desktop/internal/workbench/copy_reference.go b/desktop/internal/workbench/copy_reference.go index d8090b225d..47c85a3089 100644 --- a/desktop/internal/workbench/copy_reference.go +++ b/desktop/internal/workbench/copy_reference.go @@ -85,6 +85,8 @@ func (a *App) applyReferenceSymbols(pending *semanticPending, event core.Backend request.pending = nil p, d := a.currentSemanticDocument(request.documentID) if p != request.project || d == nil || d.view.Revision() != request.revision { + // The symbols describe a text the user has since changed or closed: nothing is copied. + a.editor.copyReference.request = nil return } var symbols []core.DocumentSymbol diff --git a/desktop/internal/workbench/copy_reference_test.go b/desktop/internal/workbench/copy_reference_test.go index 8e9172f6f4..316a4716d3 100644 --- a/desktop/internal/workbench/copy_reference_test.go +++ b/desktop/internal/workbench/copy_reference_test.go @@ -46,10 +46,6 @@ func TestCopyReferenceLocationUsesLanguageSymbols(t *testing.T) { symbolAt("DemoClass", 5, 0, 1, symbolAt("goHome(String,Integer)", 6, 0, 1)), )) - t.Cleanup(func() { - req := f.h.app.editor.copyReference.request - t.Logf("reference diagnostics: clipboard=%q pendingRequest=%v activeGroup=%q docGroup=%q selected=%p expectedDoc=%p", f.h.driver.Clipboard(), req != nil, f.p.docs.group, f.d.group, f.p.selectedDocument(f.p.docs.group), f.d) - }) f.h.await("symbol reference request settled", func() bool { return f.h.app.editor.copyReference.request == nil }) @@ -75,6 +71,9 @@ func TestCopyReferenceLocationDiscardsOldDocumentRevision(t *testing.T) { if got := f.h.driver.Clipboard(); strings.Contains(got, "Outdated") { t.Fatalf("stale reference copied: %q", got) } + if f.h.app.editor.copyReference.request != nil { + t.Fatal("a reference request for an edited document stays pending") + } } func TestEditorContextMenuCopiesReferenceAtSecondaryPress(t *testing.T) { From e438e7c826db23b4dd1a84eb0090c079c551cceb Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 17 Nov 2026 13:38:16 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix(editor):=20=E5=A4=8D=E5=88=B6=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E4=BD=8D=E7=BD=AE=E7=AD=89=E5=BE=85=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=AC=A6=E5=8F=B7=E8=AE=BE=E4=B8=8A?= =?UTF-8?q?=E9=99=90=EF=BC=8C=E5=8F=B3=E9=94=AE=E4=BD=8D=E7=BD=AE=E9=9A=8F?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=85=B3=E9=97=AD=E5=A4=B1=E6=95=88=20(#2015?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 语言服务器一直不回答时,最多等 3 秒(referenceSymbolsTimeout),之后取消请求、 记录 editor_copy_reference_symbols 日志,按没有服务器时的规则复制文件路径和行号; 回答到达或被新一次复制替换时停止计时。 - 右键坐标只属于它打开的那一次菜单:菜单画出后没选这一项就关闭,坐标丢弃, 之后 Shift+F10 打开的菜单读取光标位置。 - 新增两个回归测试,修复前失败、修复后通过;更新 Agent Note 与功能矩阵说明, 矩阵备注不再写 Core PR 待配套合入。 --- ...26-11-16-copy-editor-reference-location.md | 4 +- desktop/internal/workbench/copy_reference.go | 72 +++++++++++++++++-- .../internal/workbench/copy_reference_test.go | 66 +++++++++++++++++ desktop/internal/workbench/editor_view.go | 7 +- .../editor-copy-reference-location.json | 4 +- 5 files changed, 145 insertions(+), 8 deletions(-) diff --git a/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md b/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md index a8a48ae9b9..e894253f36 100644 --- a/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md +++ b/.agents/notes/implemented/feature/2026-11-16-copy-editor-reference-location.md @@ -16,6 +16,8 @@ Viva 编辑器的右键菜单提供复制源码位置,默认把所点行复制 - 桌面端只捕获右键坐标、管理请求生命周期并写入系统剪贴板;格式规则属于 Rust Core 的 `editor.copyReferenceLocation`。 - Core 只消费上游提供的符号名称、类型、作用域及方法签名,没有可靠信息就按 `文件路径#L行号` 回退。用户看到的一基行号由 Core 统一处理。 - 旧文档或项目、关闭的标签、后续编辑以及新一次复制都不能接收过期操作。插件会话失败与缺少符号不阻断文件路径回退。 +- 等语言服务器的文档符号最多 3 秒(`referenceSymbolsTimeout`)。提交请求有 `semanticStartTimeout`,但回答没有期限;正在索引或卡住的服务器会让菜单项点了没有结果。超时后取消请求、记录日志,按没有服务器时的规则复制 `文件路径#L行号`。 +- 右键坐标只属于它打开的那一次菜单:选中“复制源码位置”时使用;菜单没选这一项就关闭(Esc、点别处、选其他项)时丢弃。之后用 Shift+F10 打开的菜单读取光标位置,不会复制很久以前右键的行。 - 菜单复用现有共享 i18n 的“复制源码位置”(`native.copySourceLocation`),而不是在桌面端增加无法生成的硬编码界面文案。 ## 考虑过的备选方案 @@ -31,7 +33,7 @@ Viva 编辑器的右键菜单提供复制源码位置,默认把所点行复制 ## 验证 - Core: `cargo test -p lithe-editor`;`cargo test -p lithe-core copy_reference_location`。 -- Viva: `scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestCopyReferenceLocation|TestEditorContextMenuCopiesReference' -count=1`。 +- Viva: `scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestCopyReferenceLocation|TestEditorContextMenuCopiesReference|TestEditorContextMenuForgetsPress' -count=1`,其中包括服务器不回答时超时回退,以及右键菜单关闭后改用光标位置。 - 视觉: `LITHE_VISUAL_OUTPUT_DIR=.artifacts/issue-2015 scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/workbench -run '^TestVisualCopyReferenceLocation$' -count=1`。 - 两个平台原生集成与粘贴结果仍需实际执行,不能以静态源代码检查替代。 diff --git a/desktop/internal/workbench/copy_reference.go b/desktop/internal/workbench/copy_reference.go index 47c85a3089..8ef6211ad1 100644 --- a/desktop/internal/workbench/copy_reference.go +++ b/desktop/internal/workbench/copy_reference.go @@ -2,6 +2,7 @@ package workbench import ( "context" + "time" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" @@ -9,11 +10,15 @@ import ( ) // A secondary press chooses the line under the pointer, not the previous -// keyboard caret. The context-menu item consumes the coordinate after the -// popup closes; each operation owns a revision and an identity token. +// keyboard caret. The press belongs to the menu it opens: the menu's item +// consumes the coordinate after the popup closes, and a menu closed without it +// drops the coordinate (referenceMenuPainted), so a menu Shift+F10 opens later +// reads the caret. Each operation owns a revision and an identity token. type referenceClick struct { documentID int line, column int + // menuShown says the menu the press opened has been painted. + menuShown bool } type referenceRequest struct { @@ -22,11 +27,22 @@ type referenceRequest struct { line, column int path string pending *semanticPending + // wait ends the wait for pending's symbols (awaitReferenceSymbols); it is stopped when + // the symbols arrive or the request is replaced. + wait *time.Timer } +// referenceSymbolsTimeout bounds how long copying waits for the language server's symbols. +// Submitting the request is bounded by semanticStartTimeout, but nothing bounds the answer: a +// server that is indexing or stuck would leave the menu choice without a result. Past this +// wait the request is cancelled and the file and line are copied, as without a server. +const referenceSymbolsTimeout = 3 * time.Second + type copyReferenceState struct { click *referenceClick request *referenceRequest + // symbolsWait overrides referenceSymbolsTimeout for tests. + symbolsWait time.Duration } type referenceKernel interface { @@ -47,8 +63,11 @@ func (a *App) copyReferenceLocation(p *project, d *document) { line, column = click.line, click.column } a.editor.copyReference.click = nil - if previous := a.editor.copyReference.request; previous != nil && previous.pending != nil { - a.cancelSemantic(previous.pending) + if previous := a.editor.copyReference.request; previous != nil { + previous.stopWait() + if previous.pending != nil { + a.cancelSemantic(previous.pending) + } } request := &referenceRequest{ project: p, documentID: d.id, revision: d.view.Revision(), @@ -68,6 +87,7 @@ func (a *App) copyReferenceLocation(p *project, d *document) { server, offered := a.editorServer(d, featureDocumentSymbols) if offered && server != nil && a.semanticDocumentReady(d) { request.pending = a.submitEditorRequest(pluginSemanticCopyReference, p, d, server, core.PluginSemanticRequest{}) + a.awaitReferenceSymbols(request) return } // An unavailable or unsynchronized language server does not block copying: @@ -75,6 +95,49 @@ func (a *App) copyReferenceLocation(p *project, d *document) { a.finishReferenceLocation(request, nil, kernel) } +// referenceMenuPainted follows the editor menu of d in the paint that declared it: a press on +// d is kept while the menu it opened shows and dropped once that menu has closed. +func (a *App) referenceMenuPainted(d *document, shown bool) { + click := a.editor.copyReference.click + if click == nil || click.documentID != d.id { + return + } + switch { + case shown: + click.menuShown = true + case click.menuShown: + a.editor.copyReference.click = nil + } +} + +// awaitReferenceSymbols cancels request's symbols request once referenceSymbolsTimeout passes +// without an answer and copies the reference without symbols. +func (a *App) awaitReferenceSymbols(request *referenceRequest) { + wait := a.editor.copyReference.symbolsWait + if wait <= 0 { + wait = referenceSymbolsTimeout + } + pending := request.pending + request.wait = time.AfterFunc(wait, func() { + a.post(func(a *App) { + if a.editor.copyReference.request != request || request.pending != pending { + return + } + a.backgroundFailed("editor_copy_reference_symbols", context.DeadlineExceeded) + a.cancelSemantic(pending) + a.applyReferenceSymbols(pending, core.BackendEvent{}, true) + }) + }) +} + +// stopWait ends the wait for the symbols, if one is running. +func (r *referenceRequest) stopWait() { + if r.wait != nil { + r.wait.Stop() + r.wait = nil + } +} + // applyReferenceSymbols is reached through the ordinary semantic event router. // Failed, unsupported or malformed symbols retain a useful file/line fallback. func (a *App) applyReferenceSymbols(pending *semanticPending, event core.BackendEvent, failed bool) { @@ -83,6 +146,7 @@ func (a *App) applyReferenceSymbols(pending *semanticPending, event core.Backend return } request.pending = nil + request.stopWait() p, d := a.currentSemanticDocument(request.documentID) if p != request.project || d == nil || d.view.Revision() != request.revision { // The symbols describe a text the user has since changed or closed: nothing is copied. diff --git a/desktop/internal/workbench/copy_reference_test.go b/desktop/internal/workbench/copy_reference_test.go index 316a4716d3..a03f4c63de 100644 --- a/desktop/internal/workbench/copy_reference_test.go +++ b/desktop/internal/workbench/copy_reference_test.go @@ -6,8 +6,10 @@ import ( "strconv" "strings" "testing" + "time" "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/vivaui/viva/gfx" ) func TestCopyReferenceLocationWithoutServerCopiesFileLine(t *testing.T) { @@ -103,3 +105,67 @@ func TestEditorContextMenuCopiesReferenceAtSecondaryPress(t *testing.T) { return h.driver.Clipboard() == path+"#L"+strconv.Itoa(line+1) }) } + +// A language server that never answers does not hold the copy back: once the wait for its +// symbols runs out, the request is cancelled and the file and line are copied, as without a +// server. +func TestCopyReferenceLocationFallsBackWhenSymbolsNeverArrive(t *testing.T) { + f := newSemanticFixture(t) + f.server.features = map[string]bool{featureDocumentSymbols: true} + f.h.app.editor.copyReference.symbolsWait = time.Millisecond + f.d.view.SetSelection(0, 0) + f.h.app.copyReferenceLocation(f.p, f.d) + f.h.await("file and line copied without symbols", func() bool { + return f.h.driver.Clipboard() == f.d.path+"#L1" + }) + if f.h.app.editor.copyReference.request != nil { + t.Fatal("the reference request stays after its fallback was copied") + } + if len(f.h.app.semantics.pending) != 0 { + t.Fatalf("the unanswered symbols request stays pending: %+v", f.h.app.semantics.pending) + } +} + +// A secondary press belongs to the menu it opens. Once that menu closes without a choice, a +// menu opened from the keyboard copies the caret's line, not the old pointer position. +func TestEditorContextMenuForgetsPressAfterItCloses(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + root := t.TempDir() + h.open(root) + path := filepath.Join(root, "reference.txt") + if err := os.WriteFile(path, []byte("one\ntwo\nthree\n"), 0600); err != nil { + t.Fatal(err) + } + p := h.app.project + h.app.openFile(p, path) + h.settleChain() + d := p.docs.byPath(path) + if d == nil { + t.Fatal("document missing") + } + bounds := h.topHit(d.hit) + at := center(bounds) + line, _, ok := d.view.PositionAt(at.X, at.Y) + if !ok || line == 0 { + t.Fatalf("the press lands on line %d (painted %v); want a line after the first", line, ok) + } + h.rightClickAt(bounds) + if err := h.driver.Key(gfx.KeyEscape, 0); err != nil { + t.Fatal(err) + } + h.settle() + if h.shows(h.shared("native.copySourceLocation")) { + t.Fatal("Escape left the editor menu open") + } + d.view.SetSelection(0, 0) + h.app.focusDocument(d.id) + h.settle() + if err := h.driver.Key(gfx.KeyF10, gfx.ModifierShift); err != nil { + t.Fatal(err) + } + h.settle() + h.clickNamed(h.shared("native.copySourceLocation")) + h.await("caret line copied", func() bool { + return h.driver.Clipboard() == path+"#L1" + }) +} diff --git a/desktop/internal/workbench/editor_view.go b/desktop/internal/workbench/editor_view.go index 17d208210c..02e19f077f 100644 --- a/desktop/internal/workbench/editor_view.go +++ b/desktop/internal/workbench/editor_view.go @@ -180,7 +180,12 @@ func (a *App) documentView(c ui.C, group string, d *document) { a.linkSync(c, p, d) } if p := a.project; p != nil && !d.virtual { - ui.ContextMenu(c.Key("menu"+name), box, a.editorMenuItems(c, p, d)) + items, shown := a.editorMenuItems(c, p, d), false + ui.ContextMenu(c.Key("menu"+name), box, func(menu *ui.MenuItems) { + shown = true + items(menu) + }) + a.referenceMenuPainted(d, shown) at := d.actionPanel.menuAt ui.ContextMenuAt(c.Key("lanemenu"+name), box, &d.actionPanel.menuOpen, gfx.Point{X: at.X, Y: at.Y + at.Height}, a.editorActionLaneMenu(c, p, d)) a.gitGutterPeek(c, p, d, box) diff --git a/shared/platform-feature-matrix/features/editor-copy-reference-location.json b/shared/platform-feature-matrix/features/editor-copy-reference-location.json index 1aed9f925b..b19693a3aa 100644 --- a/shared/platform-feature-matrix/features/editor-copy-reference-location.json +++ b/shared/platform-feature-matrix/features/editor-copy-reference-location.json @@ -26,6 +26,6 @@ ] }, "owner": "Editor", - "notes": "通过 Viva 共用菜单复制右键所在行的引用;Rust Core 负责从同步的 documentSymbols 生成包/类/方法签名引用,没有可靠符号时回退为文件路径与行号。菜单复用现有“复制源码位置”中英文词条;Core 与桌面修复 PR 需配套合入。", - "verification": "Core 共享 fixture 和 Rust 单测;Viva Go 测试覆盖菜单、剪贴板、语言服务器回复、无服务器回退和过期结果。双端原生验收、视觉截图待运行。 Viva Headless 测试定义在 copy_reference_visual_test.go,执行后输出四组菜单与真实粘贴截图。" + "notes": "通过 Viva 共用菜单复制右键所在行的引用;Rust Core 负责从同步的 documentSymbols 生成包/类/方法签名引用,没有可靠符号时回退为文件路径与行号。菜单复用现有“复制源码位置”中英文词条;格式化命令由 Core #70 提供,桌面端固定 Core main 6a29169。", + "verification": "Core 共享 fixture 和 Rust 单测;Viva Go 测试覆盖菜单、剪贴板、语言服务器回复、无服务器回退、服务器超时不回答时的回退、右键菜单关闭后改用光标位置和过期结果。双端原生验收、视觉截图待运行。 Viva Headless 测试定义在 copy_reference_visual_test.go,执行后输出四组菜单与真实粘贴截图。" }