Sublime Forum

Source.vue doesn't work in my vue snippet in sublime text3?

#1

I have a very annoying problem with my sublime snippet about .vue type flie.
Say I want to add a vue snippet in sublime on my own, and I want the vue tabtrigger below works in vue type file only.
I add these codes into my vue.sublime-snippet:

<snippet>
	<content><![CDATA[
        Some text
]]></content>
	<tabTrigger>vue</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<scope>source.vue</scope>
</snippet>

After saving this file in my sublime folder, I create a test.vue file and type vue and then press Tab.
But nothing happened. What I expected is Some text could appear after tabbing in test.vue file.
Why doesn’t my snippet work on vue file?

PS: I changed source.vue into source.js source.php,etc in my snippet and tested in corresponding js, php file, they all work fine. Only vue didn’t work out. Is there anything wrong with sublime identifying vue type file? How to solve this problem?

0 Likes

#2

What package are you using to provide the syntax for Vue? I’m not familiar with it, but a quick check on Package Control turned up Vue Syntax Highlight, which uses the scope text.html.vue.

While you have a Vue file open, select Tools > Developer > Show Scope Name from the menu, which will show you a complete list of all of the scopes applied at the current cursor location. The first part of that will tell you what scope you need to use to target the file.

0 Likes

#3

guessing you just ignored the answer you got to your question on SO

0 Likes