4

I know how to wrap a single line of text in an HTML tag with Emmet by using Wrap with Abbreviation. It works. However, it produces the following output:

<h1>
    HTML5
</h1>

What I want is this:

<h1>HTML5</h1>

I can make some progress with this in my User Settings:

"emmet.syntaxProfiles": {
    "html": {
        "tag_nl": false            
    }
}

However, my output then looks like this, with extra whitespace:

<h1>    HTML5 </h1>

Oddly, if want to individually wrap a selection that contains multiple lines, visual studio behaves as I want. It is just individual lines that cause this behavior. For instance, if want to wrap this:

foo
bar

I end up with this, which is what I what I want:

<h1>foo</h1>
<h1>bar</h1>

Is there a way to sort this out? I just want to wrap some text in a tag with no fancy formatting:

<h1>HTML5</h1>

It is perhaps worth pointing out that WebStorm and Atom wrap as I expected. This is a Visual Studio Code specific thing.

ccalvert
  • 3,816
  • 1
  • 23
  • 22
  • Looks like a bug. You can try creating an issue https://github.com/Microsoft/vscode/issues – Alex Sep 23 '18 at 19:02

1 Answers1

0

I tried your code:

"emmet.syntaxProfiles": {
    "html": {
        "tag_nl": false            
    }
}

It works now perfectly with single line selection, but is still buggy with multiple lines (extra tabs & spaces added)

migli
  • 2,692
  • 27
  • 32