Skip to content

Commit

Permalink
Don't tokenize identifiers after dots as keywords
Browse files Browse the repository at this point in the history
FIX: Don't tokenize identifiers after periods as anything but plain identifiers.

See https://discuss.codemirror.net/t/custom-highlighting-for-property-names-in-sql/7729
  • Loading branch information
marijnh committed Jan 18, 2024
1 parent a039212 commit 4ab5417
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ export function tokensFor(d: Dialect) {
input.acceptToken(Punctuation)
} else if (isAlpha(next)) {
let word = readWord(input, String.fromCharCode(next))
input.acceptToken(input.next == Ch.Dot ? Identifier : d.words[word.toLowerCase()] ?? Identifier)
input.acceptToken(input.next == Ch.Dot || input.peek(-word.length - 1) == Ch.Dot
? Identifier : d.words[word.toLowerCase()] ?? Identifier)
}
})
}
Expand Down

0 comments on commit 4ab5417

Please sign in to comment.