How to make a Sublime Text snippet work with Emmet installed

依然范特西╮ 提交于 2019-12-11 04:13:50

问题


I am trying to make a snippet in Sublime Text 3 that only applies to CSS files. This is the snippet I have:

<snippet>
    <content><![CDATA[/*
Theme Name: ${1:Theme name here and so on...}
Theme URI: 
Author: 
Author URI: 
Description: 
Version: 1.0.0
License: 
License URI: 
Text Domain: 
Tags: 
*/]]></content>
    <tabTrigger>xyz</tabTrigger>
    <scope>source.css</scope>
</snippet>

The problem is if I open a CSS file, type xyz and hit tab all I will get is xyz: ;. So it seems as if Sublime Text has already assigned the tab to insert : ; instead of my snippet.

This problem does not occur if I remove the plugin package Emmet.

How can I get this snippet to work?


回答1:


The documentation at http://github.com/sergeche/emmet-sublime#tab-key-handler, suggests that it should be possible to get snippets to work in CSS files with Emmet enabled by adding the following preference in your Emmet preferences file:

"disabled_single_snippet_for_scopes": "source.css"



回答2:


Since you're already using Emmet, consider using an Emmet snippet instead.

{
    "css": {
        "filters": "css",
        "profile": "css",
        "snippets": {
            "xyz": "/*\nTheme Name: ${1:Theme name here and so on...}\nTheme URI: \nAuthor: \nAuthor URI: \nDescription: \nVersion: 1.0.0\nLicense: \nLicense URI: \nText Domain: \nTags: \n*/"
        }
    }
}


来源:https://stackoverflow.com/questions/41181441/how-to-make-a-sublime-text-snippet-work-with-emmet-installed

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