From 14fc3b01dba160ffd581eebfb0c99ab97e5bf957 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 17:45:03 -0400 Subject: [PATCH] Fix suggestion menus blocked by placeholder marks (#11796) * Initial plan * fix: suggestion menus not opening when typing trigger inside placeholder mark Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> --- .../editor/plugins/SuggestionsMenuPlugin.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/shared/editor/plugins/SuggestionsMenuPlugin.ts b/shared/editor/plugins/SuggestionsMenuPlugin.ts index a9cab11456..caa8c71f4f 100644 --- a/shared/editor/plugins/SuggestionsMenuPlugin.ts +++ b/shared/editor/plugins/SuggestionsMenuPlugin.ts @@ -53,6 +53,37 @@ export class SuggestionsMenuPlugin extends Plugin { }); } + // Another plugin (e.g. the Placeholder mark) may consume the + // handleTextInput event by returning true, which prevents the + // InputRule from evaluating the trigger character. We use a timeout + // here so the re-evaluation happens after all synchronous handlers + // have run, ensuring the suggestion menu still opens in those cases. + if ( + !event.ctrlKey && + !event.metaKey && + !event.altKey && + event.key.length === 1 + ) { + setTimeout(() => { + const { pos: fromPos } = view.state.selection.$from; + this.execute( + view, + fromPos, + fromPos, + openRegex, + action((_, match) => { + if (match) { + if (match[0].length <= 2) { + extensionState.open = true; + } + extensionState.query = match[1]; + } + return null; + }) + ); + }); + } + // If the menu is open then just ignore the key events in the editor // itself until we're done. if (