Skip to content

Commit 7126372

Browse files
committed
Adding additional containeds
The intention of this commit is to perhaps improve performance, but also clean up a bit of the how a couple regexes are used. By adding `contained` to `jsObjectKey`, I think we might get a nice performance boost, especially on larger files since it won't attemp that lookbehind everywhere. Adding `contained` to the newer regex for string templating stuff in ES6 seems more 'accurate' or proper.
1 parent fbe4ca0 commit 7126372

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

syntax/javascript.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ syntax case match
8080
"" Syntax in the JavaScript code
8181
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
8282
syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained
83-
syntax match jsTemplateVar "\${.\{-}}"
83+
syntax match jsTemplateVar "\${.\{-}}" contained
8484
syntax region jsStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=jsSpecial,@htmlPreproc,@Spell
8585
syntax region jsStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=jsSpecial,@htmlPreproc,@Spell
8686
syntax region jsTemplateString start=+`+ skip=+\\\\\|\\$`+ end=+`+ contains=jsTemplateVar,jsSpecial,@htmlPreproc
@@ -96,7 +96,7 @@ syntax region jsRegexpString start=+\(\(\(return\|case\)\s\+\)\@<=\|\(\([)\]
9696
syntax match jsNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
9797
syntax keyword jsNumber Infinity
9898
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
99-
syntax match jsObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\(\s*:\)\@=/ contains=jsFunctionKey
99+
syntax match jsObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\(\s*:\)\@=/ contains=jsFunctionKey contained
100100
syntax match jsFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\(\s*:\s*function\s*\)\@=/ contained
101101

102102
if g:javascript_conceal == 1

0 commit comments

Comments
 (0)