How may I tell the formatter, not to send my comments to a new line?
See original GitHub issueOriginally requested VSCode to implement this feature.
I put comments on ending divs like the following
<div class="col">
<div class="row">
<div class="card">
<h1>Some heading</h1>
<p>Some text for the card.</p>
<img src="some/image.jpg" alt="">
</div> <!-- /.card -->
</div> <!-- /.row -->
</div> <!-- /.col -->
I have also configured my emmet to put the closing div tag comments on the same line as the closing tag.
The problem:
When I format the document inside VSCode (my editor of choice) which uses js-beautify under the hood, it sends all of my closing div comments to the new line like the following,
<div class="col">
<div class="row">
<div class="card">
<h1>Some heading</h1>
<p>Some text for the card.</p>
<img src="some/image.jpg" alt="">
</div>
<!-- /.card -->
</div>
<!-- /.row -->
</div>
<!-- /.col -->
Which is a problem for me, and I have to manually backspace them back to the closing div tags. I requested VSCode team to provide a setting like “html.format.commentOnNewLine”: true, which I set to false to get the desired effect, but they replied that they’re using js-beautify under the hood which is doing the work, so I should file the feature here, which I did. 😃
Thank You for the nice beautifier and the awesome work!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:12 (5 by maintainers)
Top GitHub Comments
I agree with pillaiindu. I have the same problem. I would like to see this implemented.
Using VSCode (1.37.1) with Beautify plugin installed (1.5.0) and set to default formatter on Linux it only works properly for me if I rewrite the comments next to the tag I want to have them.
If I open a file having previously written comments and try to format it, HTML one-line comments move to the next line which is absolutely undesirable and annoying cause it “breaks” my already formatted file =(