Skip to content

Commit be2efbb

Browse files
committed
Support numeric separator (i.e. 123_456)
ECMAScript numeric separator proposal is now on stage3 https://github.com/tc39/proposal-numeric-separator and will come to TypeScript at version 2.7. microsoft/TypeScript#20324 Example: ```typescript const i = 123_456; const x = 0x1fa_EF6; const f = 123_456.0_456; const f2 = 123_456.4_5e1_2; ```
1 parent fbd0e9e commit be2efbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

syntax/typescript.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter
6565
\ start=/${/ end=/}/ contained
6666
\ contains=@typescriptExpression
6767

68-
syn match typescriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
68+
syn match typescriptNumber "-\=\<\d[0-9_]*L\=\>\|0[xX][0-9a-fA-F][0-9a-fA-F_]*\>"
6969
syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
7070
" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
7171
" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc
7272
" syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc
7373
" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline
7474
" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
75-
syntax match typescriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
75+
syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/
7676
" syntax match typescriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
7777

7878
syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/

0 commit comments

Comments
 (0)