-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Create RecordDeclarationOrganizer #48101
Conversation
var initial = | ||
@"class C { | ||
$@"{typeKind} C {{ | ||
int C; | ||
int B; | ||
int A; | ||
}"; | ||
}}"; | ||
|
||
var final = | ||
@"class C { | ||
$@"{typeKind} C {{ | ||
int A; | ||
int B; | ||
int C; | ||
}"; | ||
}}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi This looks like a nice feature that I was never aware it's existed. Can I ask where this feature is in Visual Studio? I can't find any option along the words "organize declarations"
@Youssef1313 tests are failing :) |
@CyrusNajmabadi Fixed the failing test. Is this ready to merge? |
MemberDeclarationsOrganizer.Organize(syntax.Members, cancellationToken), | ||
syntax.CloseBraceToken, | ||
syntax.SemicolonToken); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you jsut do syntax.WithModifiers(...).WithMembers(...);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi Sounds reasonable. But I followed the same pattern used in other implementations in the same folder to be consistent with them. If I'd change it here, I'd change it everywhere in the same folder too. Do you want me to update all of them in this PR? or keep it for later PR?
Note: I think WithModifiers(...).WithMembers(...)
will cause 2 allocations, while Update will cause only 1 allocation? (could that be the reason why other organizers are written in this way?)
I might be wrong, so correct me if so please.
I also would like to know where this feature exist in Visual Studio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two allocations is fine here :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also would like to know where this feature exist in Visual Studio.
The feature never shipped. But it has come up recently as something we might like to resurrect
No description provided.