Colorize type names as type identifiers in TypeScript.

Also, this reformatted the file. Not sure why, but it's better this way anyway.
This commit is contained in:
sdegutis 2024-08-23 10:14:09 -05:00
parent 9117a92944
commit e712f24618

View file

@ -75,10 +75,11 @@ export const conf: languages.LanguageConfiguration = {
}; };
export const language = { export const language = {
// Set defaultToken to invalid to see what you do not tokenize yet
defaultToken: 'invalid', defaultToken: 'invalid',
tokenPostfix: '.ts', tokenPostfix: '.ts',
typeKeywords: ['any', 'bigint', 'boolean', 'number', 'object', 'string', 'unknown', 'void'],
ctrlKeywords: [ ctrlKeywords: [
'export', 'export',
'default', 'default',
@ -107,10 +108,7 @@ export const language = {
// Should match the keys of textToKeywordObj in // Should match the keys of textToKeywordObj in
// https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts // https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts
'abstract', 'abstract',
'any',
'asserts', 'asserts',
'bigint',
'boolean',
'class', 'class',
'const', 'const',
'constructor', 'constructor',
@ -135,8 +133,6 @@ export const language = {
'never', 'never',
'new', 'new',
'null', 'null',
'number',
'object',
'out', 'out',
'package', 'package',
'private', 'private',
@ -149,7 +145,6 @@ export const language = {
'satisfies', 'satisfies',
'set', 'set',
'static', 'static',
'string',
'super', 'super',
'switch', 'switch',
'symbol', 'symbol',
@ -158,9 +153,7 @@ export const language = {
'typeof', 'typeof',
'undefined', 'undefined',
'unique', 'unique',
'unknown',
'var', 'var',
'void',
'while', 'while',
'async', 'async',
'of' 'of'
@ -291,6 +284,7 @@ export const language = {
[ [
{ {
cases: { cases: {
'@typeKeywords': 'type.identifier',
'@ctrlKeywords': 'keyword.flow', '@ctrlKeywords': 'keyword.flow',
'@keywords': 'keyword', '@keywords': 'keyword',
'$1~#?[A-Z].*': 'type.identifier', '$1~#?[A-Z].*': 'type.identifier',