Skip to content

Commit 9153f8d

Browse files
Close signature help on blur. (#1056)
Avoids poor interaction with drag and drop. We might consider something similar for autocomplete too in future. Closes #1055
1 parent b833a40 commit 9153f8d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/editor/codemirror/language-server/signatureHelp.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,5 +307,20 @@ export const signatureHelp = (
307307
signatureHelpTooltipField,
308308
signatureHelpToolTipBaseTheme,
309309
keymap.of(signatureHelpKeymap),
310+
EditorView.domEventHandlers({
311+
blur(event, view) {
312+
// Close signature help as it interacts badly with drag and drop if
313+
// you drag over the tooltip. Deal with the special case of focus
314+
// moving to the tooltip itself.
315+
if (
316+
!(event.relatedTarget instanceof Element) ||
317+
!event.relatedTarget.closest(".cm-signature-tooltip")
318+
) {
319+
view.dispatch({
320+
effects: setSignatureHelpRequestPosition.of(-1),
321+
});
322+
}
323+
},
324+
}),
310325
];
311326
};

0 commit comments

Comments
 (0)