Skip to content
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

Update find-refs to find references to Dispose in a using-statement #76221

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #34107

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 2, 2024 05:48
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 2, 2024
@@ -90,7 +90,7 @@ private static SyntaxTreeIndex CreateIndex(

containsForEachStatement = containsForEachStatement || syntaxFacts.IsForEachStatement(node);
containsLockStatement = containsLockStatement || syntaxFacts.IsLockStatement(node);
containsUsingStatement = containsUsingStatement || syntaxFacts.IsUsingStatement(node);
containsUsingStatement = containsUsingStatement || syntaxFacts.IsUsingStatement(node) || syntaxFacts.IsUsingLocalDeclarationStatement(node);
Copy link
Contributor

Choose a reason for hiding this comment

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

IsUsingLocalDeclarationStatement

To clarify for me, this is tracking both "using namespace" and "using var foo = IDisposable" statements, right? Other than the name being the same, why are they grouped together?

Copy link
Member Author

Choose a reason for hiding this comment

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

To clarify for me, this is tracking both "using namespace" and "using var foo = IDisposable" statements, right?

Yes.

Other than the name being the same, why are they grouped together?

Because this is for FindRefs, which only cares about tthis info just to say "should i look for Dispose references here?". And for FindRefs, it doesn't care about which of the two cases it is.

I could do this as two different bools, but the consumption side would then have to check for both. So i just collapse here to one bool since htat's all we need.

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.

Find All References does not support using statements
3 participants