From 4ab54172b5be9e5b45bcc1d98d5c00340d6aba98 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 18 Jan 2024 18:48:30 +0100 Subject: [PATCH] Don't tokenize identifiers after dots as keywords 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 --- src/tokens.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tokens.ts b/src/tokens.ts index fb5d162..7a1081b 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -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) } }) }