From a9ad6eb7b4d699117c959dbd02f7f3e2e14f1d02 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 Aug 2018 09:07:23 -0700 Subject: [PATCH] Match template strings while matching strings Fixes #661 --- TypeScript.YAML-tmLanguage | 5 +- TypeScript.tmLanguage | 36 +++-- TypeScriptReact.tmLanguage | 36 +++-- tests/baselines/Issue661.baseline.txt | 184 ++++++++++++++++++++++++++ tests/cases/Issue661.ts | 14 ++ 5 files changed, 232 insertions(+), 43 deletions(-) create mode 100644 tests/baselines/Issue661.baseline.txt create mode 100644 tests/cases/Issue661.ts diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index 19bf8c9a..1943ceef 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -12,7 +12,7 @@ variables: propertyAccessPreIdentifier: \??\.\s* identifier: '[_$[:alpha:]][_$[:alnum:]]*' constantIdentifier: '[[:upper:]][_$[:digit:][:upper:]]*' - quotedStrings: (\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\") + quotedStrings: (\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`) nonIdentifierPropertyName: '{{quotedStrings}}|(\[([^\[\]]|\[[^\[\]]*\])+\])' label: ({{identifier}})\s*(:) hexNumber: \b(?include #string - - include - #template - include #comment @@ -299,10 +295,6 @@ include #regex - - include - #template - include #comment @@ -1023,7 +1015,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1075,7 +1067,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1120,7 +1112,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (:) endCaptures @@ -1652,7 +1644,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1821,7 +1813,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$)) beginCaptures 1 @@ -1840,7 +1832,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?<=\}) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?<=\}) patterns @@ -2263,7 +2255,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2322,7 +2314,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2364,7 +2356,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2407,7 +2399,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) end (?=\(|\<) patterns @@ -3165,7 +3157,7 @@ begin - (?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))) + (?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))) end (?=,|\}|$) patterns @@ -6841,6 +6833,10 @@ include #qstring-double + + include + #template + qstring-double @@ -7501,7 +7497,7 @@ name comment.line.triple-slash.directive.ts begin - ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$) + ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)))+\s*/>\s*$) beginCaptures 1 diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage index 32db8c4a..6d654aef 100644 --- a/TypeScriptReact.tmLanguage +++ b/TypeScriptReact.tmLanguage @@ -47,10 +47,6 @@ include #string - - include - #template - include #comment @@ -303,10 +299,6 @@ include #regex - - include - #template - include #comment @@ -1027,7 +1019,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1079,7 +1071,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1124,7 +1116,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (:) endCaptures @@ -1656,7 +1648,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:)) end (?=,|\}) patterns @@ -1825,7 +1817,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$)) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$)) beginCaptures 1 @@ -1844,7 +1836,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?<=\}) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?<=\}) patterns @@ -2267,7 +2259,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2326,7 +2318,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2368,7 +2360,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\<]) beginCaptures 1 @@ -2411,7 +2403,7 @@ (?:\b[0-9][0-9_]*(\.)\B)| # 1. (?:\B(\.)[0-9][0-9_]*\b)| # .1 (?:\b[0-9][0-9_]*\b(?!\.)) # 1 -)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) +)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\<]) end (?=\(|\<) patterns @@ -3169,7 +3161,7 @@ begin - (?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))) + (?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))) end (?=,|\}|$) patterns @@ -6787,6 +6779,10 @@ include #qstring-double + + include + #template + qstring-double @@ -7447,7 +7443,7 @@ name comment.line.triple-slash.directive.tsx begin - ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$) + ^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)))+\s*/>\s*$) beginCaptures 1 diff --git a/tests/baselines/Issue661.baseline.txt b/tests/baselines/Issue661.baseline.txt new file mode 100644 index 00000000..4704b5d6 --- /dev/null +++ b/tests/baselines/Issue661.baseline.txt @@ -0,0 +1,184 @@ +original file +----------------------------------- +// breaks when '{' start in a new line behind a '(' +const foo = () => ( + { + num: 1, + foo: 'foo', + bar: `bar`, + // '=' break all following highlighting + baz: `baz=${123}`, + } +); + +class TestColor extends Foo { + public init() {} +} +----------------------------------- + +Grammar: TypeScript.tmLanguage +----------------------------------- +>// breaks when '{' start in a new line behind a '(' + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>const foo = () => ( + ^^^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts + ^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts + ^^ + source.ts meta.var.expr.ts meta.arrow.ts storage.type.function.arrow.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.brace.round.ts +> { + ^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts +> num: 1, + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts + ^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts +> foo: 'foo', + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts +> bar: `bar`, + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.begin.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.end.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts +> // '=' break all following highlighting + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts comment.line.double-slash.ts +> baz: `baz=${123}`, + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.begin.ts + ^^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts + ^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts + ^^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.end.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts +> } + ^^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts +>); + ^ + source.ts meta.var.expr.ts meta.arrow.ts meta.brace.round.ts + ^ + source.ts punctuation.terminator.statement.ts +> + ^ + source.ts +>class TestColor extends Foo { + ^^^^^ + source.ts meta.class.ts storage.type.class.ts + ^ + source.ts meta.class.ts + ^^^^^^^^^ + source.ts meta.class.ts entity.name.type.class.ts + ^ + source.ts meta.class.ts + ^^^^^^^ + source.ts meta.class.ts storage.modifier.ts + ^ + source.ts meta.class.ts + ^^^ + source.ts meta.class.ts entity.other.inherited-class.ts + ^ + source.ts meta.class.ts + ^ + source.ts meta.class.ts punctuation.definition.block.ts +> public init() {} + ^^ + source.ts meta.class.ts + ^^^^^^ + source.ts meta.class.ts meta.method.declaration.ts storage.modifier.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts + ^^^^ + source.ts meta.class.ts meta.method.declaration.ts meta.definition.method.ts entity.name.function.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts + ^ + source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts +>} + ^ + source.ts meta.class.ts punctuation.definition.block.ts \ No newline at end of file diff --git a/tests/cases/Issue661.ts b/tests/cases/Issue661.ts new file mode 100644 index 00000000..aed9a576 --- /dev/null +++ b/tests/cases/Issue661.ts @@ -0,0 +1,14 @@ +// breaks when '{' start in a new line behind a '(' +const foo = () => ( + { + num: 1, + foo: 'foo', + bar: `bar`, + // '=' break all following highlighting + baz: `baz=${123}`, + } +); + +class TestColor extends Foo { + public init() {} +} \ No newline at end of file