Skip to content

Commit

Permalink
Always show super/constructor as keywords, but set/delete/etc as meth…
Browse files Browse the repository at this point in the history
…ods if used that way.
  • Loading branch information
thesoftwarephilosopher committed Aug 23, 2024
1 parent d85b781 commit da0d66e
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 @@ -40,18 +40,22 @@ export const tokenProvider = {
'import', 'from', 'type',
],

alwaysKeyword: [
'constructor', 'super',
],

keywords: [
// Should match the keys of textToKeywordObj in
// https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts
'abstract', 'asserts',
'class', 'const', 'constructor', 'debugger',
'class', 'const', 'debugger',
'declare', 'delete', 'enum',
'extends', 'false', 'function', 'get',
'implements', 'in', 'infer', 'instanceof', 'interface',
'is', 'keyof', 'let', 'module', 'namespace', 'never', 'new',
'null', 'out', 'package', 'private', 'protected',
'public', 'override', 'readonly', 'require', 'global', 'satisfies',
'set', 'static', 'super', 'switch', 'symbol', 'this',
'set', 'static', 'switch', 'symbol', 'this',
'true', 'typeof', 'undefined', 'unique',
'var', 'while', 'async', 'of'
],
Expand Down Expand Up @@ -127,10 +131,11 @@ export const tokenProvider = {
{
cases: {
'@typeKeywords': 'type.identifier',
'@ctrlKeywords': 'keyword.flow',
'@keywords': 'keyword',
'@alwaysKeyword': 'keyword',
'$1~#?[A-Z].*': 'type.identifier',
'$2': 'method',
'@ctrlKeywords': 'keyword.flow',
'@keywords': 'keyword',
'@default': 'identifier',
}
},
Expand Down

0 comments on commit da0d66e

Please sign in to comment.