Skip to content

Commit

Permalink
Support numeric separator (i.e. 123_456)
Browse files Browse the repository at this point in the history
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;
```
  • Loading branch information
rhysd committed Jan 11, 2018
1 parent fbd0e9e commit be2efbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions syntax/typescript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter
\ start=/${/ end=/}/ contained
\ contains=@typescriptExpression

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

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

0 comments on commit be2efbb

Please sign in to comment.