Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual Studio 2013 indentation

Posted on 2013-11-26
16
Medium Priority
?
1,255 Views
Last Modified: 2013-12-02
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
0
Comment
Question by:rflorencio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
  • 2
16 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39680184
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?
0
 

Author Comment

by:rflorencio
ID: 39680328
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.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39680344
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?
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 39680347
Also, I am a C# developer, and maybe there is a VB.NET specific setting that is causing this.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39680376
This might also be a bug that needs to be reported to Microsoft.

Microsoft Connect -- Visual Studio Home
http://connect.microsoft.com/VisualStudio
0
 

Author Comment

by:rflorencio
ID: 39680377
Add-ons: Indent guides and Productivity Power Tools 2013
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 800 total points
ID: 39680386
I haven't installed the Productivity Power Tools yet.  I would suggest disabling that extension to see if it is the problem.
0
 

Author Comment

by:rflorencio
ID: 39680443
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.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39680631
What guide attribute gets inserted?
0
 

Author Comment

by:rflorencio
ID: 39680714
Is an example in the attached image.
img2.png
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39681002
Can you show me in the code where the attribute gets inserted?
0
 

Author Comment

by:rflorencio
ID: 39681101
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
0
 

Author Comment

by:rflorencio
ID: 39681126
Sorry left side.
0
 
LVL 18

Expert Comment

by:Gary Davis
ID: 39683617
Could your code have some lines indented with spaces and some with tabs? Consider standardizing on one or the other per file/project
0
 

Author Comment

by:rflorencio
ID: 39683802
Is possible some code blocks as indentation and others spaces. But the problem is caused therefore?
0
 
LVL 18

Accepted Solution

by:
Gary Davis earned 1200 total points
ID: 39683847
I have seen a warning bar in VS2013 that lets you know there are both and gives you buttons to tabify or untabify the file. Yes, a mixture could cause indenting issues.

You could check by using your cursor and the arrow keys over the indent spaces and see if on one line, the cursor moves 1 character at a time or jumps due to tabs.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question