Skip to content

Commit

Permalink
Fix highlight for multi-line union types (fixes #162)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd authored and HerringtonDarkholme committed Feb 20, 2020
1 parent ae182ee commit 97f53f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/basic/type.vim
Expand Up @@ -84,7 +84,7 @@ syntax region typescriptObjectType matchgroup=typescriptBraces
\ start=/{/ end=/}/
\ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier
\ nextgroup=@typescriptTypeOperator
\ contained skipwhite fold
\ contained skipwhite skipnl fold

syntax cluster typescriptTypeMember contains=
\ @typescriptCallSignature,
Expand Down
8 changes: 8 additions & 0 deletions test/syntax.vader
Expand Up @@ -645,3 +645,11 @@ Execute:
AssertEqual 'typescriptAliasDeclaration', SyntaxAt(4, 6)
AssertEqual 'typescriptAliasKeyword', SyntaxAt(5, 8)
AssertEqual 'typescriptAliasDeclaration', SyntaxAt(5, 13)

Given typescript (multi-line union (issue 162)):
type Foo =
| { bar: string }
| { baz?(): number }
Execute:
AssertEqual 'typescriptUnion', SyntaxAt(3, 3)
AssertEqual 'typescriptMember', SyntaxAt(3, 7)

0 comments on commit 97f53f6

Please sign in to comment.