visual-studiovisual-studio-2013resharperresharper-9.0

Visual Studio indent HTML tag contents


I have Resharper and Web Essentials installed in Visual Studio 2013, and would like to have the contents of an HTML tag in my .cshtml files be indented.

So what I do NOT want (and seems to be the default):

<html>
<body>
    <h1>Hello!</h1>
<body>
</html>

I DO want it to look like:

<html>
    <body>
        <h1>Hello!</h1>
    <body>
</html>

I've removed everything from Resharper -> Options -> Code Editing -> HTML -> Formatting Style -> Do Not Indent Children Of.

I've also checked Tools -> Options -> Text Editor -> HTML (Web Forms) -> Formatting -> Tag Specific Options -> Client Specific Tags -> html -> Indent Contents to no avail.

Note that I don't have a Tools -> Options -> Text Editor -> HTML -> Formatting, instead I have two subtrees, HTML and HTML (Web Forms), where only HTML (Web Forms) has the Formatting option.

Anyone know of a way to get Visual Studio to do this? It's very annoying to see my perfectly formatted HTML document go out the window whenever I add a new tag. Thanks!


Solution

  • One more reason why Resharper doesn't indent tag content - size of tag. Look for option Resharper -> Options -> Code Editing -> HTML -> Formatting Style -> Do not indent children if tag size more than If count of lines too much, Resharper' formatter doesn't indnent it. Try to set value e.g. 10000