Stopping unnecessary style corrections
A project I'm involved in has a style of inserting spaces for better visibility - like this:-
Code:
int SomeFunc ( int whatever );
but if I make any change to an existing line, VS2019 has an annoying habit of correcting to what it thinks is the 'proper' style - i.e.
Code:
int SomeFunc(int whatever);
Is there a setting somewhere that'll turn this off?
Re: Stopping unnecessary style corrections
Try looking at these VS configuration options:
Tools/Options/Text Editor/c c++/Code Style/Formatting/Spacing/spacing for function parameters
Re: Stopping unnecessary style corrections
Quote:
Originally Posted by
John E
VS2019 has an annoying habit of correcting to what it thinks is the 'proper' style
Generally, I find VS 2019 a little too complex and invasive for my taste so I've contemplated switching to VS Code for quite some time.
But now I see VS 2022 is on the brink of being released and I wouldn't want to miss that! There's a preview available already,
https://devblogs.microsoft.com/visua...now-available/
Re: Stopping unnecessary style corrections
Thanks 2kaud - I just seem to have 1 weird style thing renaming which I can't seem to track down - i.e. it's removing spaces if they're preceded by a comma. So something like this:-
Code:
void Hello (int i, bool b, unsigned u);
will keep getting converted to this:-
Code:
void Hello (int i,bool b,unsigned u);
Any idea what I'd need to change in order to disable that?
Re: Stopping unnecessary style corrections
Tools/Options/Text Editor/c c++/Code Style/Formatting/Spacing/spacing for delimiters
Same config page as before - just further down. Has options for space before/after coma etc.
Re: Stopping unnecessary style corrections
Thanks 2kaud - interestingly, my options were all disabled here. So I've just toggled them on and then off again.
Re: Stopping unnecessary style corrections
You need the option 'insert space after comma' set. If that was disabled, that's why you had no space!
Re: Stopping unnecessary style corrections
Thanks 2kaud. I corrected that and I also discovered another setting at Tools/Options/Text Editor/C C++/Code Style/Formatting/When I paste. It was initially set to Indent and format
But when I'm editing someone else’s code I tend to copy & paste it first (so that I can easily get back to the original code if I screw something up...) So it’s probably the copy & paste operation that’s been introducing a lot of the formatting problems here. :o
Re: Stopping unnecessary style corrections
The code style formatting gives you enough options to hang yourself! :)