Sublime Text 3 - Snippet doesn't fire on tab, only on CSS file

寵の児 提交于 2019-12-24 04:41:29

问题


I have a snippet that does not fire on the tab trigger. Here's my code...

<snippet>
  <content><![CDATA[
.contentBox ul{list-style: none; padding: 0;}
.contentBox ul li{padding-left: 2.5em; text-indent: -0.7em; margin-bottom: 4px;}
.contentBox ul li:before{content: "${1:•} "; color: #${2:Bullet color};}
]]></content>
  <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
  <tabTrigger>xcv</tabTrigger>
  <!-- Optional: Set a scope to limit where the snippet will trigger -->
  <!-- <scope>source.css</scope> -->
</snippet>

If I'm on an HTML file, the tab trigger (xcv) works. However, on a CSS file, it doesn't work. BUT if I select the snippet through CTRL+SHIFT+P, it will output the code. Also on CSS files, if I try the tab trigger within a selector, it will work.

I've tried setting the scope to source.css and text.css (as well as guiding it out), and none make a difference. I've also restarted Sublime.

Any ideas?


回答1:


I have same issue with you and I had found a resolution to solve it.

I had read it at: Unknown CSS Tab Completion in Sublime Text

To fixed it:

Your code: <tabTrigger>sep</tabTrigger>

Exact code to it work: <tabTrigger>sep/</tabTrigger>

Hope it helpful for you




回答2:


I had this problem for some time, and couldn't find any solution anywhere, and sure it works by putting a / behind the trigger, but what makes it not working in the first place ?

I think the answer here is emmet, and i fixed this by simply writing my trigger and instead of pressing the tab button, i press ctrl+space, and that somehow works for me, but i don't know why.

Hope this helps someone out there :)




回答3:


To solve this problem, use the following tags and then restart Sublime.

<tabTrigger>css3</tabTrigger><br>
<scope>source.css</scope>


来源:https://stackoverflow.com/questions/25629441/sublime-text-3-snippet-doesnt-fire-on-tab-only-on-css-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!