leafOfTree / vim-vue-plugin

Vim syntax and indent plugin for .vue files
The Unlicense
176 stars 9 forks source link

Support Composition Api Syntax #24

Open jjpark78 opened 3 years ago

jjpark78 commented 3 years ago

Do this plugin has a plan support composition api syntax highlight ?

it will be very nice.

leafOfTree commented 3 years ago

Hey, thank you for mentioning it. Of course we should support it. I've not learned and used the new composition API yet. I just glanced at its documentation and tried to open its basic example in vim . It seems that we will need to support the coming setup and related staff syntax highlight.

leafOfTree commented 3 years ago

Hi, I've added Vue3 composition API syntax highlight based on https://v3.vuejs.org/api/composition-api.html. They were tested in a demo Vue3 project created by the latest vue-cli.

setup ref reactive toRefs watch computed getCurrentInstance onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted onErrorCaptured onRenderTracked onRenderTriggered

Since it's new, maybe we should keep this issue open and update the plugin if something changes.

Screen Shot 2020-11-19 at 6 07 47 PM
Mootook commented 3 years ago

@leafOfTree I'm wondering if there's a js plugin you recommend to use in conjunction with this plugin? A lot of my project is in vue files, but I often have pure js files for some utilites which don't get picked up without a js plugin. I was using pangloss/vim-javascript, but that seems to conflict with this plugin: Screen Shot 2021-02-17 at 10 49 43 AM

leafOfTree commented 3 years ago

@Mootook, thank you for the feedback. I'm using Vim8.2 without any js plugin. The default syntax with a little adjustment works well for me. As you mentioned, pangloss/vim-javascript is the most popular plugin which I try to support. If you find any issues with the two, please feel free to let me know.

By the way, I just fixed the issue which is shown in the screenshot. Also, please note that let g:vim_vue_plugin_highlight_vue_keyword = 1 is required to enable the keyword syntax.

Mootook commented 3 years ago

@leafOfTree Thanks! Really appreciate the work on this plugin.

Also, just as a note, seems like vue-next (vue3) has some experimental changes to the setup/composition API out right now. https://github.com/vuejs/rfcs/blob/script-setup-2/active-rfcs/0000-script-setup.md. Probably worth waiting till its official though.

leafOfTree commented 3 years ago

I see. We could wait until it's stable.

Mootook commented 2 years ago

https://github.com/leafOfTree/vim-vue-plugin/issues/24#issuecomment-783547272 It seems the features features have been removed from 'experimental' status in 3.2 stable release.

leafOfTree commented 2 years ago

Exactly. I see that below are considered stable.