Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2022 quick action from constructor parameter to auto field creation not adding space

In VS 2022, when I press Ctrl + . on a constructor parameter and select "Create and assign field/property", the resulting code is missing spaces around the assignment operator = like this:

_logger=logger

It's not a big deal obviously but annoying to fix manually for unified formatting (defeats the purpose of quick action). Is there a setting somewhere that can fix this?

like image 833
thankyoussd Avatar asked Nov 07 '25 01:11

thankyoussd


1 Answers

If you want to avoid to reset all settings: this behavior is controlled by the following setting:

Shows options dialog for setting

It is set to Ignore spaces around binary operators by default; if you change this to Insert space before and after binary operators the space will be added.

like image 194
Markus Avatar answered Nov 09 '25 17:11

Markus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!