Skip to content

"with" element is not correctly indented when converting collection initializer #83029

@mm-jhn

Description

@mm-jhn

Version Used: VS 18.4.2

Steps to Reproduce:
Place the caret on the "new" token and invoke the codefix for IDE0028.

HashSet<string> h = new(StringComparer.Ordinal)
{
    "a",
    "b"
};

Diagnostic Id: IDE0028: Collection initialization can be simplified

Expected Behavior:
The "with" element is correctly indented.

HashSet<string> h =
[
    with(StringComparer.Ordinal),
    "a",
    "b"
];

Actual Behavior:
The "with" element has no leading whitespace on its line.

HashSet<string> h =
[
with(StringComparer.Ordinal),
    "a",
    "b"
];
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions