vue-intellisense icon indicating copy to clipboard operation
vue-intellisense copied to clipboard

How do I add vue Custom Directives intellisense?

Open hxdyj opened this issue 4 years ago • 4 comments

I define vue Custom Directives like v-permission, and how to intellisense at every Html tag.

hxdyj avatar May 14 '21 03:05 hxdyj

My CLI vue-intellisense currently works by generating the files required for the Vetur plugin.

Can you do some research on what Vetur needs in order to give intellisense for custom directives ? Then I'll gladly add support for it.

mesqueeb avatar May 14 '21 03:05 mesqueeb

Thank you for reply, I checkout vuter source code try to find location of define derective snippet, and add custom derective rebuild to use. but have not any way to define custom directive snippet.

hxdyj avatar May 14 '21 03:05 hxdyj

I have modify vetur source code and your vue-intellisense code. and published a npm package named bbl-vue-intellisense,

package.json "vetur": { "tags": "vetur/tags.json", "attributes": "vetur/attributes.json", "globalAttributes": "vetur/globalAttributes.json" }

usage same as your lib. vue-int --input ./src --output vetur --recursive

It will auto detect custom derective name and Generate globalAttributes.json like :

app.directive("foo") or app.directive("bar",()=>{})

whill be generated file like: [ { "name":"foo", "tip":"" }, { "name":"bar", "tip":"" } ]

and restart vscode , you can intellisense foo and bar at Html tag attribute.

hxdyj avatar May 18 '21 06:05 hxdyj

There is no need to modify the extension, just use html.customData to specify html custom data: vscode-custom-data vue v-else directive

ipcjs avatar Nov 13 '23 16:11 ipcjs