【问题标题】:filter.commentAfter by Emmet in Sublime Text 3 not workSublime Text 3 中 Emmet 的 filter.commentAfter 不起作用
【发布时间】:2014-08-18 19:05:42
【问题描述】:

在 ST3 的 Emmet 中,我尝试在创建标签时在给出选项卡后自定义一个小注释,例如 #div 或 .span

我读到这是 Emmet 设置中的解决方案(Emmet.sublime-settings):

"preferences": {

    "filter.commentAfter"  : "<!-- <%= attr('id', '#') %> <%= attr('class', '.') %> -->",

    "filter.commentBefore" : "<!-- <%= attr('id', '#') %> <%= attr('class', '.') %> -->"
}

但不起作用。请帮忙

【问题讨论】:

  • 这就是你的Emmet.sublime-settings 的样子吗?还是只是其中的一部分?
  • 是的,所以文件看起来,感谢@ionutvmi 修复它,我可以:)

标签: sublimetext3 emmet


【解决方案1】:

在你的 User/Emmet.sublime-settings 文件中确保你的结构是这样的

{
    "preferences": {
        "filter.commentAfter"  : "<!-- <%= attr('id', '#') %> <%= attr('class', '.') %> -->",
        "filter.commentBefore" : "<!-- <%= attr('id', '#') %> <%= attr('class', '.') %> -->"             
     }
}

它应该可以工作。
确保你不要忘记最后的|c

div#test.myclass|c

如果您想自动添加 c 过滤器,您应该将您的 syntaxProfiles 设置为类似这样的内容

{
    "preferences": {
    },
    "syntaxProfiles": {
        "html" : {
            // auto add the comments
            "filters": "html,c"
        }
    }
}

确保它与preferences处于同一级别

【讨论】:

  • 有效!谢谢@ionutvmi。无法自动添加c。在那个文件中我放了这段代码?
  • 现在可以了,我必须重新启动计算机才能使更改生效。非常感谢!
  • 有没有办法设置它只会触发 div 而不是其他元素。 .test 预计 &lt;div class="test"&gt;&lt;/div&gt;&lt;!-- /.test --&gt; h4.test 预计 &lt;h4 class="test"&gt;&lt;/div&gt;
猜你喜欢
  • 2016-02-11
  • 1970-01-01
  • 2015-12-17
  • 2016-02-01
  • 1970-01-01
  • 2014-06-05
  • 2015-11-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多