Browse Source

Fix logic for spaces after context mentions (#1827)

Matt Rubens 1 year ago
parent
commit
78bc0c12af
1 changed files with 3 additions and 5 deletions
  1. 3 5
      webview-ui/src/utils/context-mentions.ts

+ 3 - 5
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
 }