Skip to content

Commit

Permalink
Update to latest core syntaxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom1729 committed Apr 30, 2022
1 parent 500d259 commit a2a94ed
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
23 changes: 13 additions & 10 deletions extensions/typescript.syntax-extension
Original file line number Diff line number Diff line change
Expand Up @@ -530,19 +530,22 @@ contexts:
- match: \<(?!<)
scope: punctuation.definition.generic.begin.js
set:
- - meta_scope: meta.generic.js
- match: \>
scope: punctuation.definition.generic.end.js
pop: true
- ts-type-parameter-list-tail
- ts-type-parameter-list-head
- include: else-pop

- match: ','
scope: punctuation.separator.comma
push: ts-type-parameter-list-item
- include: else-pop
- ts-type-parameter-list-item
ts-type-parameter-list-tail:
- meta_scope: meta.generic.js
- match: \>
scope: punctuation.definition.generic.end.js
pop: true

- match: ','
scope: punctuation.separator.comma
push: ts-type-parameter-list-head
- include: else-pop

ts-type-parameter-list-item:
ts-type-parameter-list-head:
- match: '{{identifier_name}}'
scope: variable.parameter.generic.js
set:
Expand Down
1 change: 1 addition & 0 deletions tests/syntax_test_suites/tsx/tsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ if (a < b || c <= d) {}
// ^^^^^^^ entity.other.attribute-name
// ^ punctuation.separator.key-value
// ^^^ string.quoted.double
// ^^^^^^^^^ - meta.function
// ^^^ meta.interpolation
// ^^^^ meta.tag
// ^ meta.tag.name entity.name.tag
Expand Down
15 changes: 0 additions & 15 deletions tests/syntax_test_suites/typescript/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1229,21 +1229,6 @@ const x = {
// ^^^ variable.other.readwrite
};

<any>(<any>a);
// ^^^^^ meta.assertion
// ^ punctuation.definition.assertion.begin
// ^^^ support.type.any
// ^ punctuation.definition.assertion.end
// ^^^^^^^^ meta.group
// ^ punctuation.section.group.begin
// ^^^^^ meta.assertion
// ^ punctuation.definition.assertion.begin
// ^^^ support.type.any
// ^ punctuation.definition.assertion.end
// ^ variable.other.readwrite
// ^ punctuation.section.group.end
// ^ punctuation.terminator.statement

true ? (a) : <T,foo="a">() => {} => {} : null; // </T>;
// ^^^^ constant.language.boolean.true
// ^ keyword.operator.ternary
Expand Down
15 changes: 15 additions & 0 deletions tests/syntax_test_suites/typescript/typescript_not_tsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,18 @@ let strLength: number = (<string>someValue).length; // </string>
// ^ punctuation.definition.generic.end
// ^^ meta.function.parameters
// ^^ keyword.declaration.function.arrow

<any>(<any>a);
// ^^^^^ meta.assertion
// ^ punctuation.definition.assertion.begin
// ^^^ support.type.any
// ^ punctuation.definition.assertion.end
// ^^^^^^^^ meta.group
// ^ punctuation.section.group.begin
// ^^^^^ meta.assertion
// ^ punctuation.definition.assertion.begin
// ^^^ support.type.any
// ^ punctuation.definition.assertion.end
// ^ variable.other.readwrite
// ^ punctuation.section.group.end
// ^ punctuation.terminator.statement

0 comments on commit a2a94ed

Please sign in to comment.