Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable auto formatting only for Html pages (not c#) on VS2010?

Tags:

During the design html pages or aspx pages, I like to do the pure coding without Html Designer. The problem is that I like to have the following format on html page for better readability.

<div>
  <% if (1 == 1) { %>
    Hello
  <% } else { %>
    World
  <% } %>
</div>

As you can guess, whenever you type '}' or ';' or etc, visual studio try to do the auto format and change to the following format

<div>
  <% if (1 == 1) 
     { %>
    Hello
  <% }
     else
     { %>
    World
  <% } %>
</div>

The question is "Is it possible to disable auto formatting just only for HTML pages on VS2010? (NOT for C# code, I still like to have auto formatting for C# pages)"

like image 208
ensecoz Avatar asked Apr 19 '10 20:04

ensecoz


People also ask

How do you unformat an HTML file?

Use w3m -dump <page. html> . It will give you the text representation of the html file.

How do I turn off auto format or code?

Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.

Can I use prettier for HTML?

Languages supported by Prettier: JavaScript, TypeScript, JSX, Angular, Vue, CSS, HTML, JSON, GraphQL, and much more.

How do I save without formatting Orcode?

TIL how to save a file on VSCode without auto formatting being applied: CMD + K S . This can be useful in situations where one is working in a repository and is not interested in having a big file auto formatted, just for the sake of a trivial change.


1 Answers

Yes, go to these two spots:

Tools > Options > Text Editor > HTML > Tabs > Indenting

Select the None radio button.

Tools > Options > Text Editor > HTML > Tabs > Miscellaneous

Uncheck Format HTML on paste.

like image 106
Andrew Hare Avatar answered Sep 28 '22 06:09

Andrew Hare