Open
Description
Environment
- Visual Studio version: 2019 Enterprise Version 16.8.4
- CodeMaid version: 11.2.231
- Code language: C#
Description
When formatting comments with lists, initial indentation is sometimes removed.
Steps to recreate
Formatting this text:
// Here's a list:
// 1. This list comment is long and should be wrapped onto multiple lines. However, after being correctly wrapped with indentation, formatting the comment a second time will remove the indentation.
// 2. A similar situation occurs with a long list item that is already wrapped with indentation, but needs to be reflowed. Some of the lines will be correctly indented and some will not.
// If formatted a second time, all indentation will be lost.
// 3. A multiline list item that already has line breaks in the correct place will loose any indentation
// the first time it's formatted.
Results in this:
// Here's a list:
// 1. This list comment is long and should be wrapped onto multiple lines. However, after being correctly wrapped
// with indentation, formatting the comment a second time will remove the indentation.
// 2. A similar situation occurs with a long list item that is already wrapped with indentation, but needs to be
// reflowed. Some of the lines will be correctly indented and some will not. If formatted a second time, all
// indentation will be lost.
// 3. A multiline list item that already has line breaks in the correct place will loose any indentation the first
// time it's formatted.
Formatting a second time results in:
// Here's a list:
// 1. This list comment is long and should be wrapped onto multiple lines. However, after being correctly wrapped
// with indentation, formatting the comment a second time will remove the indentation.
// 2. A similar situation occurs with a long list item that is already wrapped with indentation, but needs to be
// reflowed. Some of the lines will be correctly indented and some will not. If formatted a second time, all
// indentation will be lost.
// 3. A multiline list item that already has line breaks in the correct place will loose any indentation the first
// time it's formatted.
Current behavior
As explained in detail in the example comments, indentation of list items is sometimes lost, and formatting the same comment a second time changes it further.
Expected behavior
Indentation of lists should be maintained and formatting a comment twice should only change it the first time. For the example above, I expect formatting it (any number of times) will yield this result:
// Here's a list:
// 1. This list comment is long and should be wrapped onto multiple lines. However, after being correctly wrapped
// with indentation, formatting the comment a second time will remove the indentation.
// 2. A similar situation occurs with a long list item that is already wrapped with indentation, but needs to be
// reflowed. Some of the lines will be correctly indented and some will not. If formatted a second time, all
// indentation will be lost.
// 3. A multiline list item that already has line breaks in the correct place will loose any indentation the first
// time it's formatted.