diff --git a/packages/editor-ui/src/plugins/codemirror/tooltips/InfoBoxTooltip.ts b/packages/editor-ui/src/plugins/codemirror/tooltips/InfoBoxTooltip.ts index db76510f7b..8b9c992fad 100644 --- a/packages/editor-ui/src/plugins/codemirror/tooltips/InfoBoxTooltip.ts +++ b/packages/editor-ui/src/plugins/codemirror/tooltips/InfoBoxTooltip.ts @@ -242,6 +242,9 @@ export const hoverTooltipSource = (view: EditorView, pos: number) => { const state = view.state.field(cursorInfoBoxTooltip, false); const cursorTooltipOpen = !!state?.tooltip; + // Don't show hover tooltips when autocomplete is active + if (completionStatus(view.state) === 'active') return null; + const jsNodeResult = getJsNodeAtPosition(view.state, pos); if (!jsNodeResult) { diff --git a/packages/editor-ui/src/plugins/codemirror/tooltips/infoBoxTooltip.test.ts b/packages/editor-ui/src/plugins/codemirror/tooltips/infoBoxTooltip.test.ts index d248cb1ac4..7c4f7f499b 100644 --- a/packages/editor-ui/src/plugins/codemirror/tooltips/infoBoxTooltip.test.ts +++ b/packages/editor-ui/src/plugins/codemirror/tooltips/infoBoxTooltip.test.ts @@ -6,6 +6,16 @@ import { n8nLang } from '@/plugins/codemirror/n8nLang'; import { hoverTooltipSource, infoBoxTooltips } from './InfoBoxTooltip'; import * as utils from '@/plugins/codemirror/completions/utils'; import * as workflowHelpers from '@/composables/useWorkflowHelpers'; +import { completionStatus } from '@codemirror/autocomplete'; + +vi.mock('@codemirror/autocomplete', async (importOriginal) => { + const actual = await importOriginal<{}>(); + + return { + ...actual, + completionStatus: vi.fn(() => null), + }; +}); describe('Infobox tooltips', () => { beforeEach(() => { @@ -99,6 +109,13 @@ describe('Infobox tooltips', () => { expect(tooltip).not.toBeNull(); expect(infoBoxHeader(tooltip?.view)).toHaveTextContent('includes(searchString, start?)'); }); + + test('should not show a tooltip when autocomplete is open', () => { + vi.spyOn(workflowHelpers, 'resolveParameter').mockReturnValue('foo'); + vi.mocked(completionStatus).mockReturnValue('active'); + const tooltip = hoverTooltip('{{ $json.str.includ|es() }}'); + expect(tooltip).toBeNull(); + }); }); });