🐛 fix(sql-editor): 修复表名悬停元数据重复展示

- 去除 Cmd/Ctrl 导航高亮 decoration 上的 hoverMessage

- 统一由 SQL hover provider 输出对象元数据

- 补充回归断言,确保表元数据只展示一次
This commit is contained in:
Syngnat
2026-06-04 10:47:30 +08:00
parent 37a094c351
commit a9d515f160
2 changed files with 9 additions and 29 deletions

View File

@@ -777,8 +777,15 @@ describe('QueryEditor external SQL save', () => {
expect(editorState.domNode.style.cursor).toBe('pointer');
const lastDecorationCall = editorState.editor.deltaDecorations.mock.calls.at(-1);
expect(lastDecorationCall?.[1]?.[0]?.options?.inlineClassName).toBe('gonavi-query-editor-link-hint');
expect(lastDecorationCall?.[1]?.[0]?.options?.hoverMessage?.value).toMatch(/(?:Ctrl|⌘) \+ 点击打开该表/);
expect(lastDecorationCall?.[1]?.[0]?.options?.hoverMessage?.value).toContain('**表** `events`');
expect(lastDecorationCall?.[1]?.[0]?.options?.hoverMessage).toBeUndefined();
const hover = editorState.hoverProviders[0]?.provideHover(
editorState.editor.getModel(),
{ lineNumber: 1, column: 27 },
);
const hoverText = String(hover?.contents?.[0]?.value || '');
expect(hoverText.match(/\*\*表\*\*/g)).toHaveLength(1);
expect(hoverText).toContain('**表** `events`');
await act(async () => {
editorState.mouseLeaveListeners[0]?.();