Skip to content

Commit 78bc0c1

Browse files
authored
Fix logic for spaces after context mentions (#1827)
1 parent 70a476e commit 78bc0c1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

webview-ui/src/utils/context-mentions.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,14 @@ export function shouldShowContextMenu(text: string, position: number): boolean {
300300

301301
const textAfterAt = beforeCursor.slice(atIndex + 1)
302302

303+
// Check if there's any whitespace after the '@'
304+
if (/\s/.test(textAfterAt)) return false
305+
303306
// Don't show the menu if it's clearly a URL
304307
if (textAfterAt.toLowerCase().startsWith("http")) {
305308
return false
306309
}
307310

308-
// If there's a space after @, don't show the menu (normal @ mention)
309-
if (textAfterAt.indexOf(" ") === 0) {
310-
return false
311-
}
312-
313311
// Show menu in all other cases
314312
return true
315313
}

0 commit comments

Comments
 (0)