Support Vue3 composition API syntax

This commit is contained in:
leafOfTree
2020-11-19 17:35:22 +08:00
parent b32c3a5bf7
commit 9f0ed056b6

View File

@@ -15,7 +15,7 @@ let s:has_init_indent = vue#GetConfig("has_init_indent",
" Syntax highlight {{{
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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 setup'
let s:indent = &sw * (1 + s:has_init_indent)
let s:keywords_regexp = '\v^\s{'.s:indent.'}(async )?<('
@@ -47,6 +47,18 @@ execute 'syntax match vueObjectFuncKey /'
\.s:match_option
\.' nextgroup=jsFuncArgs'
let s:vue3_keywords = 'ref reactive toRefs watch computed getCurrentInstance'.
\' onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted onErrorCaptured onRenderTracked onRenderTriggered'
let s:vue3_keywords_regexp = '\v<('
\.join(split(s:vue3_keywords, ' '), '|')
\.')\ze'
execute 'syntax match vueObjectFuncName /'
\.s:vue3_keywords_regexp
\.'\_s*\(/'
\.s:match_option
\.' nextgroup=jsFuncArgs'
highlight default link vueObjectKey vueObjectKeyword
highlight default link vueObjectFuncName vueObjectKeyword
highlight default link vueObjectFuncKey vueObjectKeyword