Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion syntax/basic/members.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ syntax keyword typescriptConstructor contained constructor

syntax cluster memberNextGroup contains=typescriptMemberOptionality,typescriptTypeAnnotation,@typescriptCallSignature

syntax match typescriptMember /\K\k*/
syntax match typescriptMember /#\?\K\k*/
\ nextgroup=@memberNextGroup
\ contained skipwhite

Expand Down
2 changes: 2 additions & 0 deletions syntax/common.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if main_syntax == 'typescript' || main_syntax == 'typescriptreact'
setlocal iskeyword+=$
" syntax cluster htmlJavaScript contains=TOP
endif
" For private field added from TypeScript 3.8
setlocal iskeyword+=#

" lowest priority on least used feature
syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty
Expand Down
13 changes: 13 additions & 0 deletions test/syntax.vader
Original file line number Diff line number Diff line change
Expand Up @@ -613,3 +613,16 @@ Execute:
AssertEqual 'typescriptSpecial', SyntaxAt(1, 12)
AssertEqual 'typescriptTemplate', SyntaxAt(1, 14)
AssertEqual 'typescriptTemplate', SyntaxAt(1, 17)

Given typescript (private class instance field):
class C {
#abc = 10;
foo() {
this.#abc;
}
}
Execute:
" At '#' in '#abc'
AssertEqual 'typescriptMember', SyntaxAt(2, 3)
" At 'c' in '#abc'
AssertEqual 'typescriptMember', SyntaxAt(2, 6)