Support async before vue keyword

This commit is contained in:
leafOfTree
2020-10-10 10:13:21 +08:00
parent aa50c38902
commit b8e23259e2

View File

@@ -4,7 +4,6 @@
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0) let s:highlight_vue_keyword = vue#GetConfig("highlight_vue_keyword", 0)
if !s:highlight_vue_keyword | finish | endif if !s:highlight_vue_keyword | finish | endif
let s:has_init_indent = vue#GetConfig("has_init_indent", let s:has_init_indent = vue#GetConfig("has_init_indent",
@@ -19,20 +18,31 @@ let s:has_init_indent = vue#GetConfig("has_init_indent",
let s:vue_keywords = 'name parent functional delimiters comments components directives filters extends mixins inheritAttrs model props propsData data computed watch methods template render renderError inject provide beforeCreate created beforeMount mounted beforeUpdate updated activated deactivated beforeDestroy destroyed' let s:vue_keywords = 'name parent functional delimiters comments components directives filters extends mixins inheritAttrs model props propsData data computed watch methods template render renderError inject provide beforeCreate created beforeMount mounted beforeUpdate updated activated deactivated beforeDestroy destroyed'
let s:indent = &sw * (1 + s:has_init_indent) let s:indent = &sw * (1 + s:has_init_indent)
let s:vue_keywords_regexp = '\v^\s{'.s:indent.'}<(' let s:vue_keywords_regexp = '\v^\s{'.s:indent.'}(async )?<('
\.join(split(s:vue_keywords, ' '), '|') \.join(split(s:vue_keywords, ' '), '|')
\.')\ze' \.')\ze'
execute 'syntax match vueObjectKey /'.s:vue_keywords_regexp.'\s*:/' let contains = hlexists('jsAsyncKeyword')
\? 'jsAsyncKeyword'
\: 'javaScriptReserved'
let s:vue_match_func_option = ' containedin=jsObject,javascriptVueScript'
\.' contains='.contains
\.' skipwhite skipempty nextgroup=jsFuncArgs'
execute 'syntax match vueObjectKey /'
\.s:vue_keywords_regexp
\.'\s*:/'
\.' containedin=jsObject,javascriptVueScript' \.' containedin=jsObject,javascriptVueScript'
\.' skipwhite skipempty nextgroup=jsObjectValue' \.' skipwhite skipempty nextgroup=jsObjectValue'
execute 'syntax match vueObjectFuncName /'.s:vue_keywords_regexp.'\_s*\(/' execute 'syntax match vueObjectFuncName /'
\.' containedin=jsObject,javascriptVueScript' \.s:vue_keywords_regexp
\.' skipwhite skipempty nextgroup=jsFuncArgs' \.'\_s*\(/'
\.s:vue_match_func_option
execute 'syntax match vueObjectFuncKey /'.s:vue_keywords_regexp.'\s*:\s*function>/' execute 'syntax match vueObjectFuncKey /'
\.' containedin=jsObject,javascriptVueScript' \.s:vue_keywords_regexp
\.' skipwhite skipempty nextgroup=jsFuncArgs' \.'\s*:\s*function>/'
\.s:vue_match_func_option
highlight default link vueObjectKey vueObjectKeyword highlight default link vueObjectKey vueObjectKeyword
highlight default link vueObjectFuncName vueObjectKeyword highlight default link vueObjectFuncName vueObjectKeyword