-
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
Add refactoring to convert a primary-constructor-parameter to a normal constructor. #70399
Add refactoring to convert a primary-constructor-parameter to a normal constructor. #70399
Conversation
var parameterLeadingWhitespace = GetLeadingWhitespace(p); | ||
if (parameterLeadingWhitespace.EndsWith(indentation)) | ||
var elementLeadingWhitespace = GetLeadingWhitespace(p); | ||
if (elementLeadingWhitespace.EndsWith(indentation)) |
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.
renamed to be more accurate. this helper was used for more htan just parameters.
var containgTypeAnalyzer = TryGetOrCreateAnalyzer(containingType); | ||
RegisterFieldOrPropertyAnalysisIfNecessary(containgTypeAnalyzer); | ||
var containingTypeAnalyzer = TryGetOrCreateAnalyzer(containingType); | ||
RegisterFieldOrPropertyAnalysisIfNecessary(containingTypeAnalyzer); |
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.
mispeeling
CodeActionOptionsProvider optionsProvider, | ||
CancellationToken cancellationToken) | ||
{ | ||
var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); |
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.
tried to doc this method to help make every rewrite step clear. let me know if more clarity is needed.
@genlu ptal. |
We already have an feature to do the reverse. This now lets you switch back easily.
Note: we do want this as primary constructors have limitations (for example, being able to add argument checks). So if a person starts with a primary constructor and wants to easily move off of it to make such changes, we don't want that to be an arduous process.