Skip to content

Commit

Permalink
Class fields are highlighted as variables
Browse files Browse the repository at this point in the history
  • Loading branch information
thesoftwarephilosopher committed Aug 22, 2024
1 parent c07db38 commit fcddf91
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions site/token-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
*
* 1. `...` is highlighted as a keyword now
* 2. `export/etc` are highlighted as control-flow keywords
* 3. Class fields are highlighted as variables
*
*/

export const rules = [
// { token: "identifier.ts", foreground: "9CDCFE" },
{ token: "property.ts", foreground: "9CDCFE" },
{ token: "function.ts", foreground: "DCDCAA" },
{ token: "method.ts", foreground: "DCDCAA" },
{ token: "variable.property.ts", foreground: "9CDCFE" },
// { token: "function.ts", foreground: "DCDCAA" },
// { token: "method.ts", foreground: "DCDCAA" },
// { token: "delimiter.ts", foreground: "569CD6" },
];

Expand Down Expand Up @@ -66,7 +67,11 @@ export const tokenProvider = {

// The main tokenizer for our languages
tokenizer: {
root: [[/[{}]/, 'delimiter.bracket'], { include: 'common' }],
root: [
[/[{}]/, 'delimiter.bracket'],
[/^\s*#?[\w$]+(?=\s*[;=:])/, 'variable.property'],
{ include: 'common' },
],

common: [
// identifiers and keywords
Expand Down

0 comments on commit fcddf91

Please sign in to comment.