Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

Followup to #76585

@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 30, 2024

if (status.Succeeded && result.SelectionChanged)
Assert.Equal(namedSpans["r"].Single(), result.FinalSpan);
if (status.Succeeded && namedSpans.TryGetValue("r", out var revisedSpans))
Copy link
Member Author

Choose a reason for hiding this comment

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

these tests were busted. they only ran if the code set this boolean. meaning if the code didn't set the oolean, the test might still specify these spans, but not validate tehm. i've at least updated it to always validate if present.

SemanticDocument document,
SelectionType selectionType,
TextSpan finalSpan,
bool selectionChanged) : CSharpSelectionResult(
Copy link
Member Author

Choose a reason for hiding this comment

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

remove this valiue. it was there to just signal data to tests, but iddn't affect behavior in any way.

internal enum DeclarationBehavior
{
None,
Delete,
Copy link
Member Author

Choose a reason for hiding this comment

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

completely unread. removed since i'm trying to wrap my head around all these values and what tjhey do.

public IEnumerable<VariableInfo> GetVariablesToMoveIntoMethodDefinition(CancellationToken cancellationToken)
=> Variables.Where(v => v.GetDeclarationBehavior(cancellationToken) == DeclarationBehavior.MoveIn);

public IEnumerable<VariableInfo> GetVariablesToMoveOutToCallSite(CancellationToken cancellationToken)
Copy link
Member Author

Choose a reason for hiding this comment

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

unused.

status = TryCheckVariableType(semanticModel, context, analyzeResult.GetVariablesToSplitOrMoveIntoMethodDefinition(cancellationToken), status);
status = TryCheckVariableType(semanticModel, context, analyzeResult.MethodParameters, status);
status = TryCheckVariableType(semanticModel, context, analyzeResult.GetVariablesToMoveOutToCallSite(cancellationToken), status);
status = TryCheckVariableType(semanticModel, context, analyzeResult.GetVariablesToSplitOrMoveOutToCallSite(cancellationToken), status);
Copy link
Member Author

Choose a reason for hiding this comment

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

this code was incredibly wacky. it seemed to be trying to slice the analyzeResult.Variables into all abutting subsets, to then check to see if particular disallowed types were used. But it could just access analyzeResult.Variables insetad.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review January 2, 2025 22:23
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 2, 2025 22:23
@CyrusNajmabadi
Copy link
Member Author

@JoeRobich @ToddGrun hopefully last cleanup pass PR.

@CyrusNajmabadi CyrusNajmabadi merged commit d29eff1 into dotnet:main Jan 3, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 3, 2025
@CyrusNajmabadi CyrusNajmabadi deleted the extractMethodCleanup5 branch January 3, 2025 05:47
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.

3 participants