Fix logic for spaces after context mentions (#1827)

This commit is contained in:
Matt Rubens 2025-03-20 01:07:55 -04:00 committed by GitHub
parent 70a476e722
commit 78bc0c12af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}