Link to home
Start Free TrialLog in
Avatar of rp
rpFlag for Portugal

asked on

Visual Studio 2013 indentation

I have a problem with code indentation in visual studio 2013. The problem is the same in Windows and web forms. However i have installed a plugin and in windows forms the problem is solved, but in asp.net no. When insert a new line of code the, new line indent and not should (like image example).
In windows forms with the plugin  i can insert a guide attribute and indention is corrected. But in web forms this option not exist.
Img.png
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I have been using Resharper formatting for a while, so I am not certain what is Resharper, and what is Visual Studio.  Are you saying that when you reformat the code, that those indents stay there?
Avatar of rp

ASKER

Example:

Before change code
----------------------------
if reader.read() then
     txt1=reader.item("1")
     txt2=reader.item("2")
     txt3=reader.item("3")
endif

After change a line of code
-------------------------------------
if reader.read() then
     txt1=reader.item("1")
     txt2=reader.item("2")
     txt3=reader.item("3")
         txt4=reader.item("4")
endif

Last line  txt4=reader.item("4"), should indent with txt1,txt2,txt3 but not. Even if delete space before, always back to the same position.
I was trying to remember a formatting issue that I had, and I finally figured it out.  The CSS class editor has a new indentation in 4.5:

New CSS Editor Improvements in Visual Studio (ASP.NET 4.5 Series)
http://weblogs.asp.net/scottgu/archive/2011/12/02/new-css-editor-improvements-in-visual-studio-asp-net-4-5-series.aspx

Hierarchical CSS Indentation

I tell you this not to provide a solution, but to suggest that there might be another option that is causing this, but this issue doesn't make sense, since all the lines are the same.

What add-ons (or extensions) do you have installed?
Also, I am a C# developer, and maybe there is a VB.NET specific setting that is causing this.
This might also be a bug that needs to be reported to Microsoft.

Microsoft Connect -- Visual Studio Home
http://connect.microsoft.com/VisualStudio
Avatar of rp

ASKER

Add-ons: Indent guides and Productivity Power Tools 2013
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rp

ASKER

Ever had this problem before, so I installed Indent guides and Productivity Power Tools 2013. One of them (I do not remember which) has an option in windows forms "insert guide attribute" and solve the problem. But in asp.net i can´t see this option.
What guide attribute gets inserted?
Avatar of rp

ASKER

Is an example in the attached image.
img2.png
Can you show me in the code where the attribute gets inserted?
Avatar of rp

ASKER

The attribute is inserted in right side of Class. But after i can delete attribute and save and indentation stay well.

Imports System.Data
Imports System.Data.SqlClient
System.Runtime.InteropServices.GuidAttribute("252D1695-8403-49F1-8275-CD8CCFD76FD5")> Public Class Report

End Class
Avatar of rp

ASKER

Sorry left side.
Could your code have some lines indented with spaces and some with tabs? Consider standardizing on one or the other per file/project
Avatar of rp

ASKER

Is possible some code blocks as indentation and others spaces. But the problem is caused therefore?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial