Reputation: 181
So i upgraded to VS 2022. and anytime i add a semicolon. the whole code block gets backtabbed. does anyone know how to turn this off? getting tired of hitting ctrl z repeatedly..
Before.
After
Upvotes: 11
Views: 15472
Reputation: 3
In my case, I don't like auto formatting after doing paste. To close this functionality:
Tools -> Options -> type "Formatting" in search box and choose "General" section under your preferred programming language. For me: C# -> Code Style -> Formatting -> General.
Uncheck "Automatically format on paste".
Upvotes: 0
Reputation: 1
I have had this problem since the beginning even in 17.1 turning off adaptive formatting did not work however what did work was turning off ALL "Automatic Format" under tools->options->Text Editor->C#->Code Style->Formating
I turned off everything in that section!! because I can do my own formatting.
If you do want the editor to do some formatting you can customize it in the "General" "Indentation", "New Lines", "Spacing" and "Wrapping" sub branches of the Formatting section
Upvotes: 0
Reputation: 6494
In visual studio 2022 community:
effects are reflected without even restarting visual studio
Upvotes: 1
Reputation:
I'm not sure if you ever found the correct answer to your question, but I was having the same problem, and reading the other two answers led me to figuring it out. The problem is with the adaptive formatting option being turned on. To turn it off, go to
Tools -> Options -> Text Editor -> Advanced
Uncheck 'Use adaptive formatting'
Save, and restart Visual Studio
This should do the trick for you.
Upvotes: 8
Reputation: 181
After consolidating code blocks to one block on the razor page... this seems to have corrected the issue. the indenting I believe may have been caused by some bug where the indenting fails due to attempting to address other formatted code. this is not really a solid answer but i did find that moving things around prevented this from occuring and this was nothing to do with any indenting settings within the tools text editor options.
Upvotes: 1
Reputation: 114
There is another option under Tools - Options
Text Editor - All Languages - Tabs.
Try to specify Tab size and indent size
Upvotes: -1
Reputation: 114
Text Editor - C# - Code Style - Formatting Indentation
check / uncheck boxes to see how your code will look and save when happy
Upvotes: 1