codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Clean up code to add trailing comma

Open ian-bowyer opened this issue 3 years ago • 1 comments

Environment

  • Visual Studio version: 2022 Community
  • CodeMaid version: 12.0
  • Code language: C#

Description

It is common that there is a trailing comma at the end of a array of items (I think our stylecop rules picks these up), but it would be nice to not have to always remember to add them and have the cleanup code in codemaid do it.

I'm not sure if I am missing where to set it or if the functionality is not in codemaid or indeed if its in visual studio 2022 and I cant find the setting (or find it in google)

Steps to recreate

  1. Add the following code (which is missing the trailing comma var animals = new List<string>() { "dog", "cat", "mouse" };
  2. when running cleanup (for example on save) it should add the following comma after "mouse". var animals = new List<string>() { "dog", "cat", "mouse", };

Current behavior

It does not add the trailing comma

Expected behavior

To add the trailing comma. I expect there would be some config to turn this on of off to users preference

ian-bowyer avatar Feb 24 '22 10:02 ian-bowyer

Thanks for the suggestion. We do not currently have an option to add trailing commas to lists. I'm not sure if there's a native VS option, they've been iterating a lot recently.

codecadwallader avatar Mar 11 '22 13:03 codecadwallader