Go Back
1 Vote

Selectively reformatting code in VS


Reformatting code with CONTROL+KD in Visual Studio is a great tool, and very helpful in finding extra or missing END statements. 

But the problem comes when you are making changes to large existing sources which have never had CONTROL+KD performed on them.  This can result in source code thinking you have changed every line in the source, and makes it impossible to review Pull requests.

It's fine if you are just changing a few lines and you can manually tab code to align with the existing code.

But say you are adding 100+ lines of new code as a block - say a new internal subroutine.

It would be great if you could highlight that block only and use CONTROL+KD on it, without affecting the rest of the source.

 

4 Comments | Posted by Gordon Ireland to Visual Studio Integration on 9/11/2025, 8:58 AM
Steve Ives
Try makeing a selection then using Ctrl+K+F
 

9/11/2025, 4:32 PM   0  
Gordon Ireland
I expected I should be able to select and Control KD would only work on the selection, but it works on the whole source.

What you are describing is the fuinctionlity I am looking for

I am on  the latest synergy, SDI and VS 2022, windows 11

9/11/2025, 5:08 PM   0  
Steve Ives
So it didn't work? I am also on the latest Synergy, SDI and VS 2022, Windows 11, and it works great for me.

9/11/2025, 5:10 PM   0  
Gordon Ireland
No - should I follow up with support?

9/11/2025, 5:21 PM   0  
Please log in to comment on this idea.