O
O
orsodev2020-02-11 18:13:47
Emmet
orsodev, 2020-02-11 18:13:47

How to set up autocomments in Visual Studio Code after closing a tag?

Visual Studio Code version 1.42.0 Expands when
typed
.comment|c

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

How can I make it look like this:
<div class="comment">

</div><!-- end.comment -->


In VSCode Fele>Preferences>Settings -- settings.json I
add

"emmet.preferences": {
    "filter.commentAfter": "<!--end [#ID][.CLASS] -->"
}


But why doesn't this work?
Tell me what and where to do to make it work as
it
should

The format for the filter.commentAfter preference is different and simpler in Emmet 2.0.

For example, instead of the older format

"emmet.preferences": {
    "filter.commentAfter": "\n<!-- /<%= attr('id', '#') %><%= attr('class', '.') %> -->"
}
you would use

"emmet.preferences": {
    "filter.commentAfter": "\n<!-- /[#ID][.CLASS] -->"
}
If you want support for any of the other preferences as documented in Emmet Preferences, please log a feature request.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2020-02-11
@orsodev

Add to settings.json

"emmet.preferences": {
      "filter.commentBefore": "<!-- begin [.CLASS] -->\n",
      "filter.commentAfter": "\n<!-- end [.CLASS] -->",
    },

mdfrex7amblk2wesk72hea8icsm.gif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question