diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index 37b67c8..84540b7 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -29,7 +29,7 @@ variables: # arrow function possible to detect only with => on same line ( {{typeParameters}}? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) diff --git a/TypeScript.tmLanguage b/TypeScript.tmLanguage index d1ff55f..5d477ad 100644 --- a/TypeScript.tmLanguage +++ b/TypeScript.tmLanguage @@ -408,7 +408,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -796,7 +796,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -1182,7 +1182,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -1623,7 +1623,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -3098,7 +3098,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -4335,7 +4335,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage index 56a7f3f..c757223 100644 --- a/TypeScriptReact.tmLanguage +++ b/TypeScriptReact.tmLanguage @@ -412,7 +412,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -800,7 +800,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -1186,7 +1186,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -1627,7 +1627,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -3102,7 +3102,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) @@ -4281,7 +4281,7 @@ # arrow function possible to detect only with => on same line ( (<\s*[_$[:alpha:]\{\(\[]([^<>=]|=[^<]|\<\s*[_$[:alpha:]\{\(\[]([^=<>]|=[^<])+\>)+>\s*)? # typeparameters - \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[_$[:alpha:]\{\[][^()]*)?\))*)?\) # parameteres + \(\s*([_$[:alpha:]\{\[]([^()]|\((\s*[^()]*)?\))*)?\) # parameteres (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type \s*=> # arrow operator ) diff --git a/tests/baselines/Issue540.baseline.txt b/tests/baselines/Issue540.baseline.txt new file mode 100644 index 0000000..600b11f --- /dev/null +++ b/tests/baselines/Issue540.baseline.txt @@ -0,0 +1,610 @@ +original file +----------------------------------- +// 1. Correct highlighting +doSomething = (param, { a = "default" } = {}) => { + //noop +} + +// 2. Incorrect highlighting - limitation of grammar +doSomething = (param, { + a = "default" +} = {}) => { + //noop +} + +// 3. Correct highlighting +doSomething(param, { + a = "default" +} = {}) { + //noop +} + +// 4. Correct highlighting +doSomething(param, { a = "default" } = {}) { + //noop +} + +// 5. Correct highlighting (notice config module) +doSomething(param, { + a = config.get("a") +} = {}) { + //noop +} + +// 6. Correct highlighting (notice config module) +doSomething(param, { a = config.get("a") } = {}) { + //noop +} + +// 7. Incorrect highlighting (notice config module) while 1. does +doSomething = (param, { a = config.get("a") } = {}) => { + //noop +} +----------------------------------- + +Grammar: TypeScript.tmLanguage +----------------------------------- +>// 1. Correct highlighting + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething = (param, { a = "default" } = {}) => { + ^^^^^^^^^^^ + source.ts entity.name.function.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^^^^^ + source.ts meta.arrow.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts variable.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^^^^^^^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.arrow.ts + ^^ + source.ts meta.arrow.ts storage.type.function.arrow.ts + ^ + source.ts meta.arrow.ts + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.arrow.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.arrow.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 2. Incorrect highlighting - limitation of grammar + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething = (param, { + ^^^^^^^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.brace.round.ts + ^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^^^ + source.ts meta.objectliteral.ts +> a = "default" + ^^^^ + source.ts meta.objectliteral.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts keyword.operator.assignment.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^^^^^^^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^^ + source.ts meta.objectliteral.ts meta.object.member.ts +>} = {}) => { + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts + ^^ + source.ts meta.arrow.ts storage.type.function.arrow.ts + ^ + source.ts meta.arrow.ts + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.arrow.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.arrow.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 3. Correct highlighting + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething(param, { + ^^^^^^^^^^^ + source.ts meta.function-call.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^^ + source.ts meta.objectliteral.ts +> a = "default" + ^^^^ + source.ts meta.objectliteral.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts keyword.operator.assignment.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^^^^^^^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts +>} = {}) { + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 4. Correct highlighting + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething(param, { a = "default" } = {}) { + ^^^^^^^^^^^ + source.ts meta.function-call.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts keyword.operator.assignment.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^^^^^^^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 5. Correct highlighting (notice config module) + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething(param, { + ^^^^^^^^^^^ + source.ts meta.function-call.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^^ + source.ts meta.objectliteral.ts +> a = config.get("a") + ^^^^ + source.ts meta.objectliteral.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts keyword.operator.assignment.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^^^^^^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts variable.other.object.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts punctuation.accessor.ts + ^^^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts support.function.dom.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts + ^^ + source.ts meta.objectliteral.ts meta.object.member.ts +>} = {}) { + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 6. Correct highlighting (notice config module) + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething(param, { a = config.get("a") } = {}) { + ^^^^^^^^^^^ + source.ts meta.function-call.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts keyword.operator.assignment.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^^^^^^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts variable.other.object.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts punctuation.accessor.ts + ^^^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.function-call.ts support.function.dom.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts + ^ + source.ts meta.objectliteral.ts meta.object.member.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +> + ^^ + source.ts +>// 7. Incorrect highlighting (notice config module) while 1. does + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + source.ts comment.line.double-slash.ts +>doSomething = (param, { a = config.get("a") } = {}) => { + ^^^^^^^^^^^ + source.ts entity.name.function.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^^^^^ + source.ts meta.arrow.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts variable.parameter.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^^^^^^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts meta.function-call.ts variable.other.object.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts meta.function-call.ts punctuation.accessor.ts + ^^^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts meta.function-call.ts support.function.dom.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts meta.brace.round.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts string.quoted.double.ts punctuation.definition.string.end.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts meta.brace.round.ts + ^^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts keyword.operator.assignment.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts meta.objectliteral.ts punctuation.definition.block.ts + ^ + source.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.arrow.ts + ^^ + source.ts meta.arrow.ts storage.type.function.arrow.ts + ^ + source.ts meta.arrow.ts + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.arrow.ts meta.block.ts +> //noop + ^^^^ + source.ts meta.arrow.ts meta.block.ts punctuation.whitespace.comment.leading.ts + ^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts meta.arrow.ts meta.block.ts comment.line.double-slash.ts +>} + ^ + source.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts \ No newline at end of file diff --git a/tests/cases/Issue540.ts b/tests/cases/Issue540.ts new file mode 100644 index 0000000..54bc283 --- /dev/null +++ b/tests/cases/Issue540.ts @@ -0,0 +1,40 @@ +// 1. Correct highlighting +doSomething = (param, { a = "default" } = {}) => { + //noop +} + +// 2. Incorrect highlighting - limitation of grammar +doSomething = (param, { + a = "default" +} = {}) => { + //noop +} + +// 3. Correct highlighting +doSomething(param, { + a = "default" +} = {}) { + //noop +} + +// 4. Correct highlighting +doSomething(param, { a = "default" } = {}) { + //noop +} + +// 5. Correct highlighting (notice config module) +doSomething(param, { + a = config.get("a") +} = {}) { + //noop +} + +// 6. Correct highlighting (notice config module) +doSomething(param, { a = config.get("a") } = {}) { + //noop +} + +// 7. Incorrect highlighting (notice config module) while 1. does +doSomething = (param, { a = config.get("a") } = {}) => { + //noop +} \ No newline at end of file