From 05f0fb3cd6b0b6286ed3d54e1549c826c7ff7a17 Mon Sep 17 00:00:00 2001 From: sdegutis Date: Thu, 22 Aug 2024 18:19:11 -0500 Subject: [PATCH] Move special rules out of common. --- site/token-provider.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/site/token-provider.ts b/site/token-provider.ts index 859a876..90c2556 100644 --- a/site/token-provider.ts +++ b/site/token-provider.ts @@ -73,13 +73,11 @@ export const tokenProvider = { tokenizer: { root: [ [/[{}]/, 'delimiter.bracket'], - [/^\s*#?[\w$]+(?=\s*[;=:])/, 'variable.property'], - { include: 'common' }, - ], - common: [ + // highlight class field-properties + [/^\s*#?[\w$]+(?=\s*[;=:])/, 'variable.property'], - // highlight function/class defs nicely + // highlight function/class defs [/((?:function|class)\s+)(#?[\w$]+\s*)([<(]?)/, [ { token: 'keyword' }, { @@ -97,7 +95,7 @@ export const tokenProvider = { }, ]], - // highlight var/const/let defs nicely + // highlight var/const/let defs [/((?:const|let|var)\s+)(#?[\w$]+)/, ['keyword', { cases: { '$1~const\\s+': 'constant', @@ -105,6 +103,11 @@ export const tokenProvider = { } }]], + { include: 'common' }, + ], + + common: [ + // identifiers and keywords [/#?[a-z_$][\w$]*/, { cases: { @@ -113,8 +116,7 @@ export const tokenProvider = { '@default': 'identifier', } }], - [/[A-Z][\w\$]*/, 'type.identifier'], // to show class names nicely - // [/[A-Z][\w\$]*/, 'identifier'], + [/[A-Z][\w\$]*/, 'type.identifier'], // whitespace { include: '@whitespace' },