diff --git a/packages/suggestion/src/findSuggestionMatch.ts b/packages/suggestion/src/findSuggestionMatch.ts index 888f4b6e9..68599f808 100644 --- a/packages/suggestion/src/findSuggestionMatch.ts +++ b/packages/suggestion/src/findSuggestionMatch.ts @@ -32,7 +32,11 @@ export function findSuggestionMatch(config: Trigger): SuggestionMatch { : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm') const text = $position.nodeBefore?.isText && $position.nodeBefore.text - if (!text) return null + + if (!text) { + return null + } + const textFrom = $position.pos - text.length const match = Array.from(text.matchAll(regexp)).pop()