From 73232334f004e21e556ff84041481722c0d2904a Mon Sep 17 00:00:00 2001 From: Amadeus Demarzi Date: Sun, 3 Apr 2016 19:50:52 -0700 Subject: [PATCH] Improvements to rest highlighting * Added higher specificity to the dots in the spread declaration --- syntax/javascript.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syntax/javascript.vim b/syntax/javascript.vim index 4613136e..5bd26ccc 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -215,11 +215,12 @@ endif exe 'syntax match jsFunction /\/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') -syntax match jsGenerator contained '\*' nextgroup=jsFuncName skipwhite -syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite -syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsAssignmentExpr,jsComment,jsLineComment nextgroup=jsFuncBlock keepend skipwhite skipempty -syntax match jsFuncArgCommas contained ',' -syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ +syntax match jsGenerator contained '\*' nextgroup=jsFuncName skipwhite +syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite +syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsAssignmentExpr,jsComment,jsLineComment nextgroup=jsFuncBlock keepend skipwhite skipempty +syntax match jsFuncArgCommas contained ',' +syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots +syntax match jsFuncArgRestDots contained /\.\.\./ exe 'syntax match jsArrowFunction /=>/ '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '') @@ -316,6 +317,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsModules Include HiLink jsModuleWords Include HiLink jsDecorator Special + HiLink jsFuncArgRestDots Noise HiLink jsDomErrNo Constant HiLink jsDomNodeConsts Constant