Skip to content

'Add selected parameters to constructor' should respect existing user formatting#59432

Merged
CyrusNajmabadi merged 9 commits intodotnet:mainfrom
CyrusNajmabadi:addParam
Feb 11, 2022
Merged

'Add selected parameters to constructor' should respect existing user formatting#59432
CyrusNajmabadi merged 9 commits intodotnet:mainfrom
CyrusNajmabadi:addParam

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Feb 9, 2022

Fixes #58040
Fixes #49040

Note: the 'add parameter from callsite' feature already supported this. I've extracted the actual parameter adding code to a common location that can then be used by both features to have consistent behavior.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner February 9, 2022 22:23
@ghost ghost added the Area-IDE label Feb 9, 2022
@CyrusNajmabadi CyrusNajmabadi changed the title Add selected parameter to constructor should respect existing user formatting 'Add selected parameters to constructor' should respect existing user formatting Feb 9, 2022
return newParameterSymbol;
}

private static void AddParameter(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to common location


namespace Microsoft.CodeAnalysis.AddParameter
{
internal interface IAddParameterService
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no purpose in an interface here to expose entirely static helpers.

{
internal static class AddParameterEditor
{
public static void AddParameter(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a move. nothing was changed with the logic in this.

Document invocationDocument,
IMethodSymbol method,
ITypeSymbol newParamaterType,
ITypeSymbol newParameterType,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mispeeling

{
var currentParameterList = destination.GetParameterList();

if (currentParameterList == null)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the thrust of the change. instead of directly adding hte new parameters to the method syntax here, we instead call through teh helper service which will properly wrap/indent them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same change happens for VB below

@CyrusNajmabadi CyrusNajmabadi merged commit 88f94fb into dotnet:main Feb 11, 2022
@ghost ghost added this to the Next milestone Feb 11, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the addParam branch February 11, 2022 11:02
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P2 Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants