ensecoz
ensecoz

Reputation: 900

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

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)"

Upvotes: 20

Views: 8421

Answers (4)

Eddie Fletcher
Eddie Fletcher

Reputation: 2873

I had the same issue, and I found out that it was due to Resharper, not Visual Studio.

To disable html formatting in Resharper, go to: RESHARPER > Options > Code Editing > HTML > Editor

and uncheck "Auto-format on enter" and "Auto-format on closing tag"

Upvotes: 5

James
James

Reputation: 67

Tools > Options > Text Editor > Jscript > Formatting

Uncheck "Format completed line on Enter" and "Format completed block on }"

Upvotes: 5

Andrew Dunkman
Andrew Dunkman

Reputation: 1131

Tools > Options > Text Editor > HTML > Formatting > Tag Specific Options...

It's a confusing dialog, but notice the "preview" pane near the bottom to see how each rule is going to be applied.

Upvotes: 0

Andrew Hare
Andrew Hare

Reputation: 351466

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.

Upvotes: 7

Related Questions