72 references to FindNode
Microsoft.CodeAnalysis.CSharp.Features (55)
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (2)
58
var diagnosticNode = context.Diagnostics[0].Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
88
var diagnosticNode = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (1)
92
var identifierName = location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (3)
38
var switchStatement = (SwitchStatementSyntax)switchLocation.
FindNode
(getInnermostNodeForTie: true, context.CancellationToken);
79
declaratorToRemoveNode = (VariableDeclaratorSyntax)declaratorToRemoveLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
83
var switchStatement = (SwitchStatementSyntax)switchLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
61
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
66
var node = location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
89
var invocationOrCreation = (ExpressionSyntax)invocationOrCreationLocation.
FindNode
(
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
77
var ifStatement = (IfStatementSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
81
var expressionStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[1].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
117
var localDeclarationStatement = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
121
var ifStatement = (IfStatementSyntax)diagnostic.AdditionalLocations[1].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
125
var expressionStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[2].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs (1)
44
var anonymousFunction = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixProvider.cs (1)
34
var localFunctions = diagnostics.SelectAsArray(d => d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
53
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
42
var declarations = diagnostics.Select(d => d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\MakeStructReadOnly\CSharpMakeStructReadOnlyCodeFixProvider.cs (1)
39
var typeDeclarations = diagnostics.Select(d => d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
52
var initializer = (ConstructorInitializerSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (3)
46
var node = context.Diagnostics.First().Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
86
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
94
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\QualifyMemberAccess\CSharpQualifyMemberAccessCodeFixProvider.cs (1)
23
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
68
var node = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
42
d => (ExpressionSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (1)
42
var discard = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
46
if (diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken) is not AnonymousFunctionExpressionSyntax anonymousFunction)
src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (1)
60
firstUnreachableStatementLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (2)
46
var castOrSelectInvocation = (InvocationExpressionSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
47
var typeSyntax = (TypeSyntax)diagnostic.AdditionalLocations[1].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
51
var coalesceOrIfStatement = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (2)
98
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
124
if (diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken) is not InvocationExpressionSyntax invocation)
src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (1)
81
var declaration = declarationLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
46
.SelectAsArray(d => (ParenthesizedLambdaExpressionSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
53
.SelectAsArray(d => (ObjectCreationExpressionSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (1)
42
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
82
=> (InvocationExpressionSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
54
var verbatimInterpolated = (InterpolatedStringExpressionSyntax)verbatimInterpolatedLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
61
var binary = (BinaryExpressionSyntax)diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken: cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
43
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken: cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
74
references.Add((ExpressionSyntax)diagnostic.AdditionalLocations[i].
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\CSharp\CodeFixes\UseNameofInAttribute\CSharpUseNameofInAttributeCodeFixProvider.cs (1)
43
var expression = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
51
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (1)
54
var notExpression = (PrefixUnaryExpressionSyntax)notExpressionLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
48
d => (UsingStatementSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken)).ToSet();
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (3)
49
var localDeclarationStatement = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
51
var firstAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[1].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
52
var secondAssignmentStatement = (ExpressionStatementSyntax)diagnostic.AdditionalLocations[2].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
52
var nameofInvocation = (InvocationExpressionSyntax)diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (2)
56
var node = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
96
var node = location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
71
.Select(loc => loc.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken) as IdentifierNameSyntax)
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
48
var isExpression = (BinaryExpressionSyntax)location.
FindNode
(
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
119
var node = location.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
Microsoft.CodeAnalysis.Features (16)
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (1)
302
.Select(location => location.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken)))
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
449
.Where(location => !location.IsImplicit && calleeMethodNode.Contains(location.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken)))
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
262
.ToImmutableDictionary(refLoc => refLoc.location.Location.
FindNode
(
SimplifyThisOrMe\AbstractSimplifyThisOrMeCodeFixProvider.cs (1)
50
d => (TMemberAccessExpressionSyntax)d.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken)).ToSet();
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
143
if (switchLocation.
FindNode
(getInnermostNodeForTie: true, cancellationToken) is not TSwitchSyntax switchNode)
src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (1)
55
var diagnosticNode = diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
208
return syntaxFacts.IsForEachStatement(diagnostic.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken));
src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (1)
52
d => d.Location.
FindNode
(getInnermostNodeForTie: true, cancellationToken),
src\Analyzers\Core\CodeFixes\SimplifyInterpolation\AbstractSimplifyInterpolationCodeFixProvider.cs (1)
57
var node = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (3)
42
var expressionToCoalesce = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
43
var ifStatement = diagnostic.AdditionalLocations[1].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
44
var whenTrueStatement = diagnostic.AdditionalLocations[2].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\Core\CodeFixes\UseCompoundAssignment\AbstractUseCompoundAssignmentCodeFixProvider.cs (1)
59
var assignment = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
65
var ifStatement = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\Core\CodeFixes\UseExplicitTupleName\UseExplicitTupleNameCodeFixProvider.cs (1)
40
var oldNameNode = diagnostic.Location.
FindNode
(
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
63
var invocation = diagnostic.AdditionalLocations[0].
FindNode
(getInnermostNodeForTie: true, cancellationToken: cancellationToken);