From 78bc0c12af643547eb136b99aca5c63cf4f71427 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 20 Mar 2025 01:07:55 -0400 Subject: [PATCH] Fix logic for spaces after context mentions (#1827) --- webview-ui/src/utils/context-mentions.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/webview-ui/src/utils/context-mentions.ts b/webview-ui/src/utils/context-mentions.ts index 8408e1a11d..463eedb04e 100644 --- a/webview-ui/src/utils/context-mentions.ts +++ b/webview-ui/src/utils/context-mentions.ts @@ -300,16 +300,14 @@ export function shouldShowContextMenu(text: string, position: number): boolean { const textAfterAt = beforeCursor.slice(atIndex + 1) + // Check if there's any whitespace after the '@' + if (/\s/.test(textAfterAt)) return false + // Don't show the menu if it's clearly a URL if (textAfterAt.toLowerCase().startsWith("http")) { return false } - // If there's a space after @, don't show the menu (normal @ mention) - if (textAfterAt.indexOf(" ") === 0) { - return false - } - // Show menu in all other cases return true }