codemaid
codemaid copied to clipboard
Clean up code to add trailing comma
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
- Add the following code (which is missing the trailing comma
var animals = new List<string>() { "dog", "cat", "mouse" }; - 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
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.