Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting of object initializers depend on max line length #1437

Open
albert-tk25 opened this issue Jan 14, 2025 · 0 comments
Open

Formatting of object initializers depend on max line length #1437

albert-tk25 opened this issue Jan 14, 2025 · 0 comments

Comments

@albert-tk25
Copy link

Currently properties for object initializers are put on different lines of the expression length is greater than max line length and on same line otherwise, which looks strange.

Input:

var sort = new CustomSort() 
{ 
    Order = OrderBy.Ascending, 
    Field = CustomSortBy.Title 
};

var sort = new CustomSort() 
{ 
    Order = OrderBy.Ascending, 
    Field = CustomSortBy.Title,
    AnotherField =  CustomSortBy.Name
};

Output:

var sort = new CustomSort() { Order = OrderBy.Ascending, Field = CustomSortBy.Title };

var sort = new CustomSort() 
{ 
    Order = OrderBy.Ascending, 
    Field = CustomSortBy.Title,
    AnotherField =  CustomSortBy.Name
};

Expected behavior:

var sort = new CustomSort() 
{ 
    Order = OrderBy.Ascending, 
    Field = CustomSortBy.Title 
};

var sort = new CustomSort() 
{ 
    Order = OrderBy.Ascending, 
    Field = CustomSortBy.Title,
    AnotherField =  CustomSortBy.Name
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant