diff --git a/frontend/src/components/QueryEditor.external-sql-save.test.tsx b/frontend/src/components/QueryEditor.external-sql-save.test.tsx index 2b05f95..13733cb 100644 --- a/frontend/src/components/QueryEditor.external-sql-save.test.tsx +++ b/frontend/src/components/QueryEditor.external-sql-save.test.tsx @@ -983,6 +983,35 @@ describe('QueryEditor external SQL save', () => { })); }); + it('keeps ctrl+q object info silent when no object is recognized', async () => { + editorState.value = 'select 1'; + autoFetchState.visible = true; + backendApp.DBGetDatabases.mockResolvedValueOnce({ success: true, data: [{ Database: 'main' }] }); + backendApp.DBGetTables.mockResolvedValueOnce({ success: true, data: [{ Tables_in_main: 'users' }] }); + backendApp.DBGetAllColumns.mockResolvedValueOnce({ success: true, data: [] }); + + await act(async () => { + create(); + }); + await act(async () => { + await Promise.resolve(); + await Promise.resolve(); + }); + + const showObjectInfoAction = editorState.editor.addAction.mock.calls + .map((call: any[]) => call[0]) + .find((action: any) => action?.id === 'gonavi.queryEditor.showObjectInfo'); + expect(showObjectInfoAction).toBeTruthy(); + + editorState.position = { lineNumber: 1, column: 1 }; + await act(async () => { + showObjectInfoAction.run(); + }); + + expect(editorState.contentHoverCalls).toHaveLength(0); + expect(messageApi.info).not.toHaveBeenCalled(); + }); + it('adds separate object and column color decorations', async () => { editorState.value = 'select users.id from users'; autoFetchState.visible = true; diff --git a/frontend/src/components/QueryEditor.tsx b/frontend/src/components/QueryEditor.tsx index ca4d316..51d4d58 100644 --- a/frontend/src/components/QueryEditor.tsx +++ b/frontend/src/components/QueryEditor.tsx @@ -2820,13 +2820,7 @@ const QueryEditor: React.FC<{ tab: TabData; isActive?: boolean }> = ({ tab, isAc keybindings: showObjectInfoKeybinding, run: () => { const preferredPosition = lastHoverTargetPositionRef.current || editor.getPosition?.(); - const shown = showObjectInfoAtPosition(preferredPosition); - if (!shown) { - void message.info({ - key: 'gonavi-query-editor-object-info-miss', - content: '当前光标未定位到可识别的表或字段。', - }); - } + showObjectInfoAtPosition(preferredPosition); }, });