From 80abb57fbd47b4b39ece391ad39c7655cba110e7 Mon Sep 17 00:00:00 2001 From: sdegutis Date: Thu, 22 Aug 2024 06:26:12 -0500 Subject: [PATCH] new Foo and type params. --- site/token-provider.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/token-provider.tsx b/site/token-provider.tsx index d841bd3..b9c6f0c 100644 --- a/site/token-provider.tsx +++ b/site/token-provider.tsx @@ -39,6 +39,9 @@ export const tokenProvider: monaco.languages.IMonarchLanguage = { // foo( [/(#?[a-z_][\w\$]*)(\()/, ['method', 'delimiter']], + // new Foo( + [/(new\s+)([A-Z][\w\$]*)(\()/, ['keyword', 'type.identifier', 'delimiter']], + // Foo( [/([A-Z][\w\$]*)(\()/, ['function', 'delimiter']], @@ -58,6 +61,9 @@ export const tokenProvider: monaco.languages.IMonarchLanguage = { // regular expression: ensure it is terminated before beginning (otherwise it is an operator) [/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/, { token: 'regexp', bracket: '@open', next: '@regexp' }], + // type params (to avoid parsing them as jsx) + [/](?!@symbols)/, '@brackets'], @@ -145,6 +151,11 @@ export const tokenProvider: monaco.languages.IMonarchLanguage = { [/`/, 'string', '@pop'], ], + typeparams: [ + [/>/, 'delimiter', '@pop'], + { include: 'common' }, + ], + bracketCounting: [ [/\{/, 'delimiter.bracket', '@bracketCounting'], [/\}/, 'delimiter.bracket', '@pop'],