Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

Fixes #73148

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 20, 2025 21:39
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 20, 2025
@CyrusNajmabadi
Copy link
Member Author

@dotnet/roslyn-ide @JoeRobich @ToddGrun ptal

Comment on lines +239 to +246
else if (identifier.Parent is ArgumentSyntax
{
Parent: TupleExpressionSyntax tupleExpression,
NameColon: null,
} argument &&
!SyntaxFacts.IsReservedTupleElementName(identifier.Identifier.ValueText) &&
tupleExpression.Arguments.Count(a => nonConflictReferences.Contains(a.Expression)) == 1)
{
Copy link
Member

Choose a reason for hiding this comment

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

Indentation seems off here.

Suggested change
else if (identifier.Parent is ArgumentSyntax
{
Parent: TupleExpressionSyntax tupleExpression,
NameColon: null,
} argument &&
!SyntaxFacts.IsReservedTupleElementName(identifier.Identifier.ValueText) &&
tupleExpression.Arguments.Count(a => nonConflictReferences.Contains(a.Expression)) == 1)
{
else if (identifier.Parent is ArgumentSyntax
{
Parent: TupleExpressionSyntax tupleExpression,
NameColon: null,
} argument &&
!SyntaxFacts.IsReservedTupleElementName(identifier.Identifier.ValueText) &&
tupleExpression.Arguments.Count(a => nonConflictReferences.Contains(a.Expression)) == 1)
{

Copy link
Member Author

Choose a reason for hiding this comment

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

The Formatter doesn't like that, and gives an ide0055 error :+)

editor.ReplaceNode(
spreadElement,
(_, _) => collectionToInline.Elements.Select(
e => e.WithLeadingTrivia(leadingTrivia).WithoutTrailingTrivia()));
Copy link
Member

Choose a reason for hiding this comment

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

Why do we want to remove trailing trivia here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not needed. Will remove!

editor.ReplaceNode(
spreadElement,
(_, _) => collectionToInline.Elements.Select(
e => e.WithLeadingTrivia(leadingTrivia).WithoutTrailingTrivia()));
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
e => e.WithLeadingTrivia(leadingTrivia).WithoutTrailingTrivia()));
e => e.WithLeadingTrivia(leadingTrivia)));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inlining collection expression local into a spread could inline more aggressively

3 participants