skip to Main Content

I have used Emmet in the past and I am following along with a Udemy course. I am experiencing some frustrating behaviour from it right now while using VS Code, as far as I am aware Emmet is baked into VS Code (?).

The wrap with abbreviation seems to not be working as expected, seems to clear text that is below my selection and deletes other tags

Below is my starting point

I am trying to wrap the selected text with emmet using wrap with abbreviation(M W), you can see the line breaks have been removed after hitting the hotkeys

After entering ul for the emmet abbreviation I get this, the text has its line breaks back and it has somehow overwritten a part of the next tag.

I then finish the abbreviation with <li> to get my 5 items and I get this, as expected but I have lost a chunk of my element below it. Any ideas?

2

Answers


  1. Chosen as BEST ANSWER

    So I figured it out. I had format on save turned ON. For some reason it clears any line breaks for text that isn't within a tag when the file is saved, which doesn't seem to play ball with Emmet. I turned this setting off and it works perfectly now.


  2. When you use Emmet Wrap, the file loses focus, causing it to auto-save, which triggers all auto-formatters. They may shift text, but the same part is still selected.

    Try to manually save the file (ctrlS), and then use Emmet Wrap.

    I once faced this problem too, but figured it out myself.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search