Formatting in the editor

  • Thread starter Thread starter Ken Allen
  • Start date Start date
K

Ken Allen

While I like many of the features of the C# editor in Visual Studio, the
default control for indentation drives me nuts!

Regardless of how I lay it out, the editor frequently reformats my code!

For example, I am accustomed to coding standards that require that when a
procedure call involves more than three parameters and it cannot be written
on a single line on the screen, then the first parameter should be on the
first line and each subsequent parameter should be on a lone by itself and
vertically aligned with the first parameter name.

The C# editor permits me to do this, but then it automatically changes this
so each subsequent line in indented only one tab stop at intervals during my
typing! To me this makes the code much more difficult to read.

Is the a way to convince the editor not to automatically perform these
automatic reformats?

-Ken
 
Ken Allen said:
Regardless of how I lay it out, the editor frequently
reformats my code!
[...]
Is the a way to convince the editor not to automatically
perform these automatic reformats?

Tools > Options > Environment > Text Editor

P.
 
Text Editor is at the same level as Environment, not under it; and there are
no settings there to permit me to change the control of the indentation that
I can see.

-Ken

Paul E Collins said:
Ken Allen said:
Regardless of how I lay it out, the editor frequently
reformats my code!
[...]
Is the a way to convince the editor not to automatically
perform these automatic reformats?

Tools > Options > Environment > Text Editor

P.
 
Ken said:
Text Editor is at the same level as Environment, not under it; and there are
no settings there to permit me to change the control of the indentation that
I can see.

Text Editor -> C# -> Formatting -> Uncheck 'Automatically format [...]'.

This was the first setting I changed in VS.NET, since it wouldn't let me
use K&R bracing style.

I wonder why they have this on by default? It's a real pain, IMO.
Perhaps K&R bracing style is a little too Unix-like for MS ;-)
 
How disappointing that the only option is off or on -- it would be nice if
one could control this a bit more. I like that the editor auto-formats at
times, but I do not want it automatically re-formatting sections that I have
carefully lined up.

-Ken

C# Learner said:
Ken said:
Text Editor is at the same level as Environment, not under it; and there are
no settings there to permit me to change the control of the indentation that
I can see.

Text Editor -> C# -> Formatting -> Uncheck 'Automatically format [...]'.

This was the first setting I changed in VS.NET, since it wouldn't let me
use K&R bracing style.

I wonder why they have this on by default? It's a real pain, IMO.
Perhaps K&R bracing style is a little too Unix-like for MS ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top