简体   繁体   English

编辑 Emmet 自动评论结束标签 | VS代码

[英]Edit Emmet Auto Comment Closing Tag | VS Code

Is there a way for the following changes to the auto-complete a comment using Emmet in VS code:有没有办法在 VS 代码中使用 Emmet 对自动完成评论进行以下更改:

1. Auto-add comment to a UL tag? 1.自动添加注释到 UL 标签? Currently, it will do it of an #ID and.class目前,它将使用#ID 和.class 来完成

2. Is it possible to edit the auto comment to add End ie: 2.是否可以编辑自动评论以添加结束即:


  <div class="hero"></div>
  <!-- /.hero -->

change to:

  <div class="hero"></div>
  <!-- /.End hero -->


Here's the code in the VS Code User Preferences:

  "emmet.preferences": {
    "filter.commentAfter\n": "<!-- /[#ID][.CLASS] -->"
  },
   "emmet.syntaxProfiles": {
    // Enable XHTML dialect for HTML syntax
    // “html”: “xhtml”
    "html": {
      "filters": "html, c"
    }
  }

You can just add the text you want to the comment filter:您可以将您想要的文本添加到评论过滤器中:

"emmet.preferences": {
  "filter.commentAfter": "\n<!-- /End [#ID][.CLASS] -->"
}

You will end up with:你最终会得到:

<div class="hi"></div>
<!-- /End .hi -->

<div id="hi"></div>
<!-- /End #hi -->

Note the .注意. or # will be before the class or id in the comment - no way to change that.#将在评论中的classid之前 - 无法更改它。

If you don't want the .如果你不想要. or # use this instead:或者#使用这个代替:

"filter.commentAfter": "\n<!-- /End [ID][CLASS] -->"

Also, the slash / before END is purely optional - it is just more text you added - you can remove that if you want.此外, END之前的斜杠/完全是可选的 - 它只是您添加的更多文本 - 如果需要,您可以将其删除。 And I moved the \n from where you had it in your question.我把\n从你问题中的位置移走了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM