support for css class names, identifiers within javascript strings

This commit is contained in:
ManjaroOne666 2017-09-24 16:25:50 +01:00
parent 138d0bf57f
commit 6a16760fdd
1 changed files with 7 additions and 2 deletions

View File

@ -54,8 +54,10 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
" Strings, Templates, Numbers
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell,htmlTag,htmlEndTag,cssClassRegion,cssIdRegion,htmlArgRegion extend
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell,htmlTag,htmlEndTag,cssClassRegion,cssIdRegion,htmlArgRegion extend
syntax match jsCssClassName "\.-\=[A-Za-z_][A-Za-z0-9_-]*" contained
syntax match jsCssIdentifier "#-\=[A-Za-z_][A-Za-z0-9_-]*" contained
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell,htmlTag,htmlEndTag,cssClassRegion,cssIdRegion,htmlArgRegion,jsCssClassName,jsCssIdentifier extend
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell,htmlTag,htmlEndTag,cssClassRegion,cssIdRegion,htmlArgRegion,jsCssClassName,jsCssIdentifier extend
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
@ -381,6 +383,9 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsCssStyles Label
HiLink jsCssClassName cssClassName
HiLink jsCssIdentifier cssIdentifier
delcommand HiLink
endif