Skip to content

Commit 4dd559c

Browse files
committed
Support vue3 composition api
1 parent d15590d commit 4dd559c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

syntax/patch/javascript.vim

+9-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ syntax match javaScriptNumber '\v<-?\d+L?>|0[xX][0-9a-fA-F]+>'
2222
\ containedin=@javascript display
2323
highlight link javaScriptNumber Constant
2424

25-
" Vue keywords
25+
" Check if Vue keywords syntax are enabled
2626
if !s:keyword | finish | endif
2727

28-
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 beforeUnmount unmounted errorCaptured renderTracked renderTriggered'
28+
let s:vue_keywords = 'name parent functional delimiters comments components directives filters extends mixins inheritAttrs model props propsData data methods template render renderError inject provide beforeCreate created beforeMount mounted beforeUpdate updated activated deactivated beforeDestroy destroyed beforeUnmount unmounted errorCaptured renderTracked renderTriggered'
2929

3030
let s:indent = &sw * (1 + s:enable_initial_indent)
3131
let s:keywords_regexp = '\v^\s{'.s:indent.'}(async )?<('
@@ -63,10 +63,13 @@ execute 'syntax match vueObjectFuncKey display /'
6363
\.s:match_option
6464
\.' nextgroup=jsFuncArgs'
6565

66-
let s:vue3_keywords = 'ref reactive toRefs watch computed'.
67-
\' onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount'.
68-
\' onUnmounted onErrorCaptured onRenderTracked onRenderTriggered'.
69-
\' getCurrentInstance'
66+
" https://v3.vuejs.org/api/
67+
let s:basic_reactive = 'reactive readonly isProxy isReactive isReadonly toRaw markRaw shallowReactive shallowReadonly'
68+
let s:refs = 'ref unref toRef toRefs isRef customRef shallowRef triggerRef'
69+
let s:computed_and_watch = 'computed watchEffect watchPostEffect watchSyncEffect watch'
70+
let s:composition = 'setup onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted onErrorCaptured onRenderTracked onRenderTriggered onActivated onDeactivated getCurrentInstance InjectionKey provide inject'
71+
let s:vue3_keywords = s:basic_reactive.' '.s:refs.' '.s:computed_and_watch.' '.s:composition
72+
7073
let s:vue3_keywords_regexp = '\v<('
7174
\.join(split(s:vue3_keywords, ' '), '|')
7275
\.')\ze'

0 commit comments

Comments
 (0)