VSFormatOnSave icon indicating copy to clipboard operation
VSFormatOnSave copied to clipboard

RemoveAndSort Functionality Clarification

Open broderickt2 opened this issue 1 year ago • 1 comments

I want to confirm I am not using this wrong. Is the RemoveAndSort supposed to run when saving a file as well and doing the bulk format? The impression I am getting is that when I save a file, this program would do all of the necessary formatting I enabled (cleaning up or adding whitespace, removing extra imports, etc). I am saving a .cs file by the way.

When I save a file that has extra whitespace and click save, it cleans up the whitespace. But is it also supposed to remove unused/extra imports at the top with the save? Upon saving a file or doing the bulk format, it seems the using/import statements at the top are not cleaned up in my files. Here are my current settings: image

Here is what I am using: Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.10.2

Am I using this wrong or misunderstanding? Or is there an issue with functionality maybe?

broderickt2 avatar Jul 19 '24 20:07 broderickt2

You are right. The RemoveAndSort should run when saving a .cs file.

But the SmartRemoveAndSort may prevent RemoveAndSort if the .cs file contains #if statement, because RemoveAndSort might do wrong thing in such case.

Sorry for the late reply.

tifish avatar Aug 20 '24 15:08 tifish