Search

Auto Indent fails for ASP.NET MVC3 Razor documents by Simon Mattes

Closed
as Deferred Help for as Deferred

19
0
Sign in
to vote
Type: Bug
ID: 650455
Opened: 3/9/2011 1:42:25 PM
Access Restriction: Public
1
Workaround(s)
11
User(s) can reproduce this bug
When creating a view for a controller, auto format (Ctrl+E, D) fails to format the document properly:

@{
    ViewBag.Title = "Test";
}
<h2>
    Test</h2>
<div>
    @using( Html.BeginForm() )
{

}
</div>
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010 SP1

What category (if any) best represents this feedback?

Reliability

Steps to reproduce

Create a new simple view for an ASP.NET MVC3 controller using the Razor view-engine and use the following source:

@{
    ViewBag.Title = "Test";
}
<h2>Test</h2>
<div>
@using( Html.BeginForm() )
{

}
</div>

Then auto format the document.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

@{
    ViewBag.Title = "Test";
}
<h2>
    Test</h2>
<div>
    @using( Html.BeginForm() )
{

}
</div>

Expected results

@{
    ViewBag.Title = "Test";
}
<h2>Test</h2>
<div>
    @using( Html.BeginForm() )
    {

    }
</div>
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/25/2011 at 8:57 AM
Thank you for passing along this issue to us. At this point, we are pulling together this and other feedback as part of our planning and evaluation for the next release. We know that our customers are the most qualified people to help us learn how to make our products better, and we greatly appreciate hearing from you.
Posted by Duckboy on 3/10/2011 at 6:22 AM
Oh, and this isn't just a "re-format" issue; this happens just on regular editing, too. When pressing Enter in a Razor document, the cursor comes up in the wrong place on the following line (for me, it's always less indented than it should be).
Posted by Duckboy on 3/10/2011 at 6:19 AM
When editing a Razor document (cshtml in my case), the Visual Studio editor appears to be using 2-space indents (" ") rather than honouring the setting specified in Tools/Options/Editor/All Languages/Tabs.

I'm using VS 2010 SP1.
Posted by Microsoft on 3/9/2011 at 7:25 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/9/2011 at 2:13 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Robert Koritnik on 2/6/2012 at 4:02 AM
Change editor indenting from TABs to SPACEs and it will indent correctly. But this is just a workaround. A fix should be created to address this bug.