Skip to content

Commit

Permalink
skip if char before undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmacarthy committed Mar 8, 2024
1 parent 7eea87f commit 002d589
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/extension/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ export const getCharacterBefore = (index = -1): string => {
const textBeforeRange = new Range(cursorPosition, new Position(0, 0))
const textBefore = document.getText(textBeforeRange)
const characterBefore = textBefore.at(index) as string

if (!characterBefore) return 'skip'

if (!characterBefore.trim()) {
return getCharacterBefore(index - 1)
}
Expand Down

0 comments on commit 002d589

Please sign in to comment.