Search code examples
htmlword-wrapvisual-studio-code

Prevent Visual Studio Code taking new line when editing HTML tag attributes


I have an annoying issue when editing HTML in VS Code. If I have an element say a button:

<button class="btn btn-success" id="myBtn" style="width: 50%"></button>

When I hit a certain number of characters on a line of code with a tag and start typing more characters into that line e.g

<button class="btn btn-success" id="myBtn" style="width: 50%">Click here</button>

VS Code will automatically separate the line and spread the tag across two lines like so:

<button class="btn btn-success" id="myBtn" 
style="width: 50%">Click here</button>

I like to keep code files short when I can and this can be quite annoying when this happens as there is plenty of space on the original line above. I have tried disabling word wrap in settings, set the wrap line length for HTML to 0 etc. but the behaviour persists. How can I completely disable this from automatically happening?


Solution

  • Fixed it. It was to due to my extensions. Prettier and rewrap (which I only thought was for comments) were the culprits here. No more auto rewrap happening anymore.