7
7
7GIT2020-03-08 01:59:32
Visual Studio Code
7GIT, 2020-03-08 01:59:32

What is the name of the Visual Studio Code plugin that automatically adds a comment at the end of the closing HTML block with classes and IDs?

Something like this:

<div class="test">
<h1>Какой-то текст</h1>
</div><!-- test -->

Answer the question

In order to leave comments, you need to log in

2 answer(s)
7
7GIT, 2020-03-10
@7GIT


Emmet's solution can do this:
Enter
.container|c
Press Tab

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

V
valejer, 2020-03-08
@valejer

This can be done with snippets. For example:

{
  "div element": {
    "scope": "html",
    "prefix": "div",
    "body": [
      "<div class=\"$1\">",
      "    $2",
      "</div><!-- end $1 -->"
    ],
    "description": "commented div"
  }
}

But you will need such snippets for the section, header, footer tags, etc.
Therefore, you can do it like this:
{
  "commented element": {
    "scope": "html",
    "prefix": "div", // тут любое сочетание букв, как удобно
    "body": [
      "<$1 class=\"$2\">",
      "    $3",
      "</$1><!-- end $2 -->"
    ],
    "description": "commented element"
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question