From 8f7537dee5f98605890bbd60197304add88d86ef Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 5 Dec 2018 23:40:45 +0100 Subject: [PATCH] Fixes Microsoft/monaco-editor#1224 --- src/typescript/typescript.test.ts | 20 ++++++++++++++++++++ src/typescript/typescript.ts | 1 + 2 files changed, 21 insertions(+) diff --git a/src/typescript/typescript.test.ts b/src/typescript/typescript.test.ts index 0154ae57..dc8bdb67 100644 --- a/src/typescript/typescript.test.ts +++ b/src/typescript/typescript.test.ts @@ -481,6 +481,26 @@ testTokenization('typescript', [ ] }], + [{ + line: 'var x = !/`/.test(\'a\');', + tokens: [ + { startIndex: 0, type: 'keyword.ts' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.ts' }, + { startIndex: 5, type: '' }, + { startIndex: 6, type: 'delimiter.ts' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'delimiter.ts' }, + { startIndex: 9, type: 'regexp.ts' }, + { startIndex: 12, type: 'delimiter.ts' }, + { startIndex: 13, type: 'identifier.ts' }, + { startIndex: 17, type: 'delimiter.parenthesis.ts' }, + { startIndex: 18, type: 'string.ts' }, + { startIndex: 21, type: 'delimiter.parenthesis.ts' }, + { startIndex: 22, type: 'delimiter.ts' }, + ] + }], + [{ line: '/foo/', tokens: [ diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 1c3e38d5..4bb02b2d 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -135,6 +135,7 @@ export const language = { // delimiters and operators [/[()\[\]]/, '@brackets'], [/[<>](?!@symbols)/, '@brackets'], + [/!(?=([^=]|$))/, 'delimiter'], [/@symbols/, { cases: { '@operators': 'delimiter',