Quantcast
Channel: Active questions tagged tabs - Stack Overflow
Viewing all articles
Browse latest Browse all 587

Visual Studio 2022 Community: Tab Spacing Off (Extra Indent?)

$
0
0

Just a few days ago Visual Studio (VS) 2022 Community seemed to be indenting fine for me, placing the cursor indented after a line of braces with braces lining up and so on. Today, however, I found that it was indenting a line after pressing "Enter." I thought I had fixed this after setting no tabs to be inserted after newlines (for IntelliSense), but indentation generally still seems to be off.

Example #1:With Indenting set to Smart, if I set tab size as 4 and indent size as 4, then when trying to type the opening brace for class Foo, I get the following result:

public class Foo    {        int bar;    }

Now the four spaces (relatively speaking) between the curly braces and the int of int bar; are desired, but what is with the leading indentation of the braces?

Example #2:If I now set Indenting to Block, (and still with tab size and indent size as both 4), then I get this for the same attempted code as for the above example:

public class Foo {        int bar;}

Now there are eight spaces leading the int of int bar;. Likewise, what is up with the indentation here?

I can of course turn off Smart or Block indentation, but then I'm back to manual, which, by the way, gives me the following for the same tab size and indent size as above (4) when I go to type out the Foo class:

public class Foo{    }

And if I then go to write the int bar;, an extra indentation occurs, giving:

public class Foo{        int bar;    }

 So no matter how I seem to set the Indentation-specific setting for the language (C#), I end up with a weird case of indentation involving an extra indent somewhere (Example #1 had it before the two braces; Example #2 had it before the int bar;; and manually has it before the closing brace and again with int bar;.) May I ask how to resolve this indentation, to return to how it was before (where indentation was automatically recognized to be four spaces for a block, without unneeded extra indentation being inserted while also not having it be manual)? 

Also, just in case, the tab size and indent size for "All Languages" as well as for C# are set to 4. The above setting of Indenting (Smart, then Block, then None for the above three examples, respectively) is for C# specifically; when I try to set it for "All Languages", I get the message:

The indentation settings for individual text formats conflict with each other.

and so the radio buttons for Indenting for "All Languages" remains unselected even if I do select one.


Viewing all articles
Browse latest Browse all 587

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>