233 references to FindNode
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (1)
42 SyntaxNode targetNode = root.FindNode (diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
DynamicallyAccessedMembersCodeFixProvider.cs (1)
103 if (root.FindNode (diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true) is not SyntaxNode targetNode)
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (2)
74if (root?.FindNode(span) is not ExpressionSyntax invocationExpression) 326return (doc, (root!.FindNode(invocationExpression.Span) as ExpressionSyntax)!);
MakeExeTypesInternalFixer.cs (1)
29var node = root?.FindNode(context.Span);
Microsoft.Analyzers.Extra.Tests (1)
CallAnalysis\LegacyLoggingTests.cs (1)
823var targetClass = targetRoot!.FindNode(RoslynTestUtils.MakeTextSpan(TargetSourceCode, 0)) as ClassDeclarationSyntax;
Microsoft.AspNetCore.App.CodeFixes (13)
Authorization\AddAuthorizationBuilderFixer.cs (2)
59var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 136var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Dependencies\AddPackageFixer.cs (1)
50var node = root.FindNode(location);
DetectMismatchedParameterOptionalityFixer.cs (1)
45var param = root.FindNode(diagnostic.Location.SourceSpan);
Http\HeaderDictionaryAddFixer.cs (4)
70var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 87var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 101var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 115var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Http\HeaderDictionaryIndexerFixer.cs (1)
51var param = root.FindNode(diagnostic.Location.SourceSpan);
PublicPartialProgramClassFixer.cs (1)
38var classDeclaration = root.FindNode(diagnostic.Location.SourceSpan)
RouteParameterUnusedParameterFixer.cs (1)
60var param = root.FindNode(diagnostic.Location.SourceSpan);
WebApplicationBuilderFixer.cs (2)
79var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 94var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
RequestDelegateGeneratorSuppressor.cs (1)
50|| sourceTree.GetRoot().FindNode(location.SourceSpan) is not InvocationExpressionSyntax node
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixAction.cs (1)
131var diagnosticNode = root.FindNode(_diagnostic.Location.SourceSpan);
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (1)
57var ifBlockSyntax = rootNode!.FindNode(_ifBlockSpan);
Microsoft.CodeAnalysis (2)
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
1267for (var node = location.SourceTree.GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (1)
166for (var node = location.SourceTree.GetRoot().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.CodeStyle (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (3)
23=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 26=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 29=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
787? root.FindNode(span.Value, findInTrivia, getInnermostNodeForTie)
Microsoft.CodeAnalysis.CodeStyle.Fixes (37)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
58var node = root.FindNode(span, getInnermostNodeForTie: true) as TExpressionSyntax;
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
75var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
60var initialNode = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
38var diagnosticNode = root.FindNode(context.Span, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
33var parentMethod = root.FindNode(context.Span).FirstAncestorOrSelf<TMemberDeclarationSyntax>();
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
55var paramNode = root.FindNode(span, findInsideTrivia: true);
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
51var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
50declarators.Add(root.FindNode(diagnosticSpan, getInnermostNodeForTie: true).FirstAncestorOrSelf<TSymbolSyntax>()!);
src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
37var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
58var node = root.FindNode(span);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (2)
33if (root.FindNode(diagnostic.Location.SourceSpan) != null) 44var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
39if (root.FindNode(diagnostic.Location.SourceSpan) is { } node && syntaxFacts.IsAttribute(node) || 76if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute &&
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
166var node = root.FindNode(context.Span, getInnermostNodeForTie: true); 402var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 678var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\AbstractSimplifyLinqExpressionCodeFixProvider`3.cs (1)
57return (TInvocationExpressionSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
37var node = syntaxRoot.FindNode(context.Span, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (2)
34root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) 45var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
51var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 52var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 53var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
63var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 64var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 65var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (5)
77var conditionalExpressionOrIfStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 102var conditionalPart = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan, getInnermostNodeForTie: true); 103var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true); 150var whenTrueStatement = (TStatementSyntax)root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 151var match = (TExpressionSyntax)root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
68var diagnosticNode = (TDiagnosticNode)originalRoot.FindNode(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
354var selectionNode = root.FindNode(selectionTrimmed, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
83var node = root.FindNode(sourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
38var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
49var node = root.FindNode(diagnostic.Location.SourceSpan); 85var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
51var location = root.FindNode(span);
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
81var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 84var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 125var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan); 128var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 131var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
115var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
70var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
48var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
80var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (4)
48var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 49var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 50var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 51var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
74if (root.FindNode(context.Span, getInnermostNodeForTie: true) is SimpleNameSyntax node)
Formatting\CodeCleanupTests.TestFixers.cs (1)
36var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan);
Microsoft.CodeAnalysis.CSharp.Features (24)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
362var node = compilationUnit.FindNode(span, getInnermostNodeForTie: true);
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (1)
151var node = editor.OriginalRoot.FindNode(fixSpan);
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
83var node = root.FindNode(sourceSpan);
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
38var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
49var node = root.FindNode(diagnostic.Location.SourceSpan); 85var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
51var location = root.FindNode(span);
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
81var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 84var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 125var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan); 128var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 131var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
115var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
70var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
48var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
80var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (4)
48var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 49var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 50var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 51var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
215var spanNode = root.FindNode(span);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
316var oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan); 339var newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
3614var symbolInfo = semanticModel.GetSymbolInfo(crefSyntax.FindNode(new TextSpan(91, 34)));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (21)
Syntax\LambdaUtilitiesTests.cs (1)
51var node = tree.GetRoot().FindNode(span.Value);
Syntax\SyntaxDiffingTests.cs (2)
308var node = root.FindNode(span, getInnermostNodeForTie: true) as SimpleNameSyntax; 373var node = root.FindNode(span, getInnermostNodeForTie: true) as SimpleNameSyntax;
Syntax\SyntaxNodeTests.cs (18)
706Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: false)); 707Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: true)); 715Assert.Equal(classDecl, root.FindNode(identifier.Span, findInsideTrivia: false)); 716Assert.Equal(identifier, root.FindNode(identifier.Span, findInsideTrivia: true)); 719Assert.Equal(classDecl, root.FindNode(classDecl.Identifier.Span, findInsideTrivia: false)); 723Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia: false)); 724Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia: true)); 728Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(EOFSpan)); 733Assert.Equal(classDecl2, root.FindNode(nodeEndPositionSpan, findInsideTrivia: false)); 734Assert.Equal(classDecl2, root.FindNode(nodeEndPositionSpan, findInsideTrivia: true)); 735Assert.Equal(classDecl2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia: false)); 736Assert.Equal(classDecl2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia: true)); 738Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(nodeEndPositionSpan)); 742Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 744Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 746Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 748Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 750Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(root.FullSpan));
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Simplification\CSharpSimplificationService.cs (1)
194if (root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4994var node = root.FindNode(span, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.EditorFeatures (1)
InlineRename\AbstractEditorInlineRenameService.cs (1)
57var containingNode = root.FindNode(textSpan);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
CodeLens\AbstractCodeLensTest.cs (4)
34var declarationSyntaxNode = syntaxNode.FindNode(span); 61var declarationSyntaxNode = syntaxNode.FindNode(span); 87var declarationSyntaxNode = syntaxNode.FindNode(span); 113var declarationSyntaxNode = syntaxNode.FindNode(span);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.cs (1)
886return SemanticModel.SyntaxTree.GetRoot().FindNode(destSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.Features (34)
ChangeSignature\AbstractChangeSignatureService.cs (1)
461var node = root.FindNode(location.SourceSpan, findInsideTrivia: true, getInnermostNodeForTie: true);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (1)
224var subtreeRoot = root.FindNode(new TextSpan(previousOfStart.FullSpan.Start, spanEnd - previousOfStart.FullSpan.Start));
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (3)
45var node = root.FindNode(diagnostic.Location.SourceSpan); 74var node = root.FindNode(diagnostic.Location.SourceSpan); 97var referencedSymbolNode = root.FindNode(location.Location.SourceSpan);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
95var closestNode = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
76var closestNode = root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
220=> root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true) as TSnippetSyntax;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
47var node = syntaxRoot.FindNode(span);
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (1)
82var innerMatch = root.FindNode(span, getInnermostNodeForTie: true);
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
68var ifOrElseIf = root.FindNode(ifOrElseIfSpan);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
55var paramNode = root.FindNode(span, findInsideTrivia: true);
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
51var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
37var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (1)
44var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (1)
76if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute &&
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
402var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 678var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\AbstractSimplifyLinqExpressionCodeFixProvider`3.cs (1)
57return (TInvocationExpressionSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (1)
45var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
51var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 52var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 53var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
63var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 64var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 65var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (5)
77var conditionalExpressionOrIfStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 102var conditionalPart = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan, getInnermostNodeForTie: true); 103var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true); 150var whenTrueStatement = (TStatementSyntax)root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 151var match = (TExpressionSyntax)root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.Test.Utilities (1)
MarkedSource\SourceWithMarkedNodes.cs (1)
122var node = root.FindNode(marker.MarkedSyntax, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
38Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsClauseSyntax) 45Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
40Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features (3)
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.vb (1)
39Dim node = root.FindNode(context.Span, getInnermostNodeForTie:=True)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
40Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (1)
503Dim newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (16)
TestSyntaxNodes.vb (16)
2256Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=False)) 2257Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=True)) 2271Assert.Equal(classStatement, root.FindNode(classStatement.Identifier.Span, findInsideTrivia:=False)) 2274Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia:=False)) 2275Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia:=True)) 2280Assert.Throws(Of ArgumentOutOfRangeException)(Sub() classDecl2.FindNode(EOFSpan)) 2285Assert.Equal(classStatement2, root.FindNode(nodeEndPositionSpan, findInsideTrivia:=False)) 2286Assert.Equal(classStatement2, root.FindNode(nodeEndPositionSpan, findInsideTrivia:=True)) 2287Assert.Equal(classStatement2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia:=False)) 2288Assert.Equal(classStatement2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia:=True)) 2291Assert.Throws(Of ArgumentOutOfRangeException)(Sub() classDecl.FindNode(nodeEndPositionSpan)) 2295Assert.Throws(Of ArgumentOutOfRangeException)(Sub() root.FindNode(invalidSpan)) 2297Assert.Throws(Of ArgumentOutOfRangeException)(Sub() root.FindNode(invalidSpan)) 2299Assert.Throws(Of ArgumentOutOfRangeException)(Sub() classDecl2.FindNode(invalidSpan)) 2301Assert.Throws(Of ArgumentOutOfRangeException)(Sub() classDecl2.FindNode(invalidSpan)) 2303Assert.Throws(Of ArgumentOutOfRangeException)(Sub() classDecl.FindNode(root.FullSpan))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Simplification\VisualBasicSimplificationService.vb (1)
170Dim node = root.FindNode(diagnostic.Location.SourceSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
38Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsClauseSyntax) 45Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (1)
VisualBasicSyntaxFactsServiceTests.vb (1)
510Dim node = tree.GetRoot().FindNode(span)
Microsoft.CodeAnalysis.Workspaces (10)
FindSymbols\SymbolFinder.cs (1)
279var linkedNode = linkedSyntaxRoot.FindNode(location.Span, getInnermostNodeForTie: true);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
226var node = root.FindNode(this.Span);
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
67stack.Add(root.FindNode(span));
ReassignedVariable\AbstractReassignedVariableService.cs (1)
69stack.Add(root.FindNode(span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (3)
23=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 26=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 29=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
787? root.FindNode(span.Value, findInTrivia, getInnermostNodeForTie)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
68var diagnosticNode = (TDiagnosticNode)originalRoot.FindNode(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
354var selectionNode = root.FindNode(selectionTrimmed, getInnermostNodeForTie: true);
Microsoft.Interop.ComInterfaceGenerator (3)
Analyzers\AddMarshalAsToElementFixer.cs (1)
30SyntaxNode node = root.FindNode(context.Span);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
125SyntaxNode node = root.FindNode(context.Span); 202SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan);
Microsoft.Interop.LibraryImportGenerator (6)
Analyzers\ConvertToLibraryImportFixer.cs (1)
293SyntaxNode? referenceNode = root.FindNode(location.Location.SourceSpan);
Analyzers\CustomMarshallerAttributeFixer.cs (2)
44SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan); 116SyntaxNode node = root.FindNode(context.Span);
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
36ISymbol diagnosedSymbol = model.GetDeclaredSymbol(diagnostic.Location.SourceTree.GetRoot(context.CancellationToken).FindNode(diagnostic.Location.SourceSpan), context.CancellationToken);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (2)
125SyntaxNode node = root.FindNode(context.Span); 202SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan);
Microsoft.ML.InternalCodeAnalyzer (1)
RelaxTestNamingSuppressor.cs (1)
42var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Mvc.Api.Analyzers.Test (4)
ActualApiResponseMetadataFactoryTest.cs (4)
77var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 374var methodSyntax = (MethodDeclarationSyntax)syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 394var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 413var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan);
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexCodeFixer.cs (2)
51SyntaxNode nodeToFix = root.FindNode(context.Span, getInnermostNodeForTie: true); 140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);