261 references to FindNode
Microsoft.CodeAnalysis (2)
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
1188for (var node = location.SourceTree.GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (1)
162for (var node = location.SourceTree.GetRoot().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.CodeStyle (4)
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);
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.CodeStyle.Fixes (40)
AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
58var node = root.FindNode(span, getInnermostNodeForTie: true) as TExpressionSyntax;
AbstractAddDocCommentNodesCodeFixProvider.cs (1)
33var parentMethod = root.FindNode(context.Span).FirstAncestorOrSelf<TMemberDeclarationSyntax>();
AbstractAddExplicitCastCodeFixProvider.cs (2)
65var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) 202d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
AbstractAddParameterCodeFixProvider.cs (1)
59var initialNode = root.FindNode(diagnostic.Location.SourceSpan);
AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
38var diagnosticNode = root.FindNode(context.Span, getInnermostNodeForTie: true);
AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
AbstractForEachCastCodeFixProvider.cs (1)
51var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
50declarators.Add(root.FindNode(diagnosticSpan, getInnermostNodeForTie: true).FirstAncestorOrSelf<TSymbolSyntax>()!);
AbstractMakeTypePartialCodeFixProvider.cs (1)
37var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
55var paramNode = root.FindNode(span, findInsideTrivia: true);
AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
158var node = root.FindNode(context.Span, getInnermostNodeForTie: true); 390var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 666var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractSimplifyLinqExpressionCodeFixProvider`3.cs (1)
57return (TInvocationExpressionSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractUnsealClassCodeFixProvider.cs (1)
37var node = syntaxRoot.FindNode(context.Span, getInnermostNodeForTie: true);
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
71var objectCreation = (TObjectCreationExpressionSyntax)originalRoot.FindNode(
AbstractUseInferredMemberNameCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan);
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); 149var whenTrueStatement = (TStatementSyntax)root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 150var match = (TExpressionSyntax)root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
69var objectCreation = (TObjectCreationExpressionSyntax)originalRoot.FindNode(
AddParameterService.cs (1)
111var methodNode = syntaxRoot.FindNode(methodDeclaration.Locations[0].SourceSpan, getInnermostNodeForTie: true);
Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
NamingStyleCodeFixProvider.cs (1)
61var node = root.FindNode(span);
RemoveRedundantEqualityCodeFixProvider.cs (1)
51var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (2)
37if (root.FindNode(diagnostic.Location.SourceSpan) != null) 48var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
43if (root.FindNode(diagnostic.Location.SourceSpan) is { } node && syntaxFacts.IsAttribute(node) || 80if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute &&
UpdateLegacySuppressionsCodeFixProvider.cs (2)
38root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) 49var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
55var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 56var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 57var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
67var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 68var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 69var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
72var node = root.FindNode(sourceSpan);
CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (29)
AbstractAssignOutParametersCodeFixProvider.cs (1)
51var location = root.FindNode(span);
AddInheritdocCodeFixProvider.cs (2)
59var node = root.FindNode(diagnostic.Location.SourceSpan); 95var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
CSharpAddBracesCodeFixProvider.cs (1)
43var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
71var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
CSharpConvertToRecordCodeFixProvider.cs (1)
42var baseTypeSyntax = root.FindNode(span) as BaseTypeSyntax;
CSharpMakeMemberRequiredCodeFixProvider.cs (2)
50var node = root.FindNode(span); 115var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
CSharpUseDefaultLiteralCodeFixProvider.cs (1)
58d => (DefaultExpressionSyntax)originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true));
CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
86var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
EmbeddedStatementPlacementCodeFixProvider.cs (1)
72var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
84var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 87var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 128var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan); 131var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 134var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan);
MakeLocalFunctionStaticCodeFixHelper.cs (2)
68var referenceNode = root.FindNode(location.Location.SourceSpan); 138var referenceNode = root.FindNode(referenceSpan);
MakeRefStructCodeFixProvider.cs (1)
51if (root.FindNode(span).GetAncestor<TypeDeclarationSyntax>() is not StructDeclarationSyntax structDeclaration)
PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
81.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
UseExplicitTypeCodeFixProvider.cs (1)
51var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseExplicitTypeForConstCodeFixProvider.cs (2)
46if (root.FindNode(context.Span) is VariableDeclarationSyntax variableDeclaration && 70var variableDeclaration = (VariableDeclarationSyntax)root.FindNode(span);
UseImplicitTypeCodeFixProvider.cs (1)
50var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseThrowExpressionCodeFixProvider.cs (4)
54var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 55var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 56var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 57var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
74if (root.FindNode(context.Span, getInnermostNodeForTie: true) is SimpleNameSyntax node)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
317var oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan); 340var newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan);
Formatting\CodeCleanupTests.TestFixers.cs (3)
36var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan); 105var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan); 161var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan);
Microsoft.CodeAnalysis.CSharp.Features (35)
AbstractAssignOutParametersCodeFixProvider.cs (1)
51var location = root.FindNode(span);
AddInheritdocCodeFixProvider.cs (2)
59var node = root.FindNode(diagnostic.Location.SourceSpan); 95var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
359var node = compilationUnit.FindNode(span, getInnermostNodeForTie: true);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
223var node = editor.OriginalRoot.FindNode(fixSpan);
CSharpAddBracesCodeFixProvider.cs (1)
43var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
71var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
CSharpConvertToRecordCodeFixProvider.cs (1)
42var baseTypeSyntax = root.FindNode(span) as BaseTypeSyntax;
CSharpMakeMemberRequiredCodeFixProvider.cs (2)
50var node = root.FindNode(span); 115var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
72var node = root.FindNode(sourceSpan);
CSharpUseDefaultLiteralCodeFixProvider.cs (1)
58d => (DefaultExpressionSyntax)originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true));
CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
86var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
EmbeddedStatementPlacementCodeFixProvider.cs (1)
72var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
InvokeDelegateWithConditionalAccessCodeFixProvider.cs (5)
84var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 87var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan); 128var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan); 131var ifStatement = (IfStatementSyntax)root.FindNode(ifStatementLocation.SourceSpan); 134var expressionStatement = (ExpressionStatementSyntax)root.FindNode(expressionStatementLocation.SourceSpan);
MakeLocalFunctionStaticCodeFixHelper.cs (2)
68var referenceNode = root.FindNode(location.Location.SourceSpan); 138var referenceNode = root.FindNode(referenceSpan);
MakeRefStructCodeFixProvider.cs (1)
51if (root.FindNode(span).GetAncestor<TypeDeclarationSyntax>() is not StructDeclarationSyntax structDeclaration)
PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
81.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
86var node = root.FindNode(TextSpan.FromBounds(position, position));
UseExplicitTypeCodeFixProvider.cs (1)
51var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseExplicitTypeForConstCodeFixProvider.cs (2)
46if (root.FindNode(context.Span) is VariableDeclarationSyntax variableDeclaration && 70var variableDeclaration = (VariableDeclarationSyntax)root.FindNode(span);
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
219var spanNode = root.FindNode(span);
UseImplicitTypeCodeFixProvider.cs (1)
50var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseThrowExpressionCodeFixProvider.cs (4)
54var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 55var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 56var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 57var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
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)
704Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: false)); 705Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: true)); 713Assert.Equal(classDecl, root.FindNode(identifier.Span, findInsideTrivia: false)); 714Assert.Equal(identifier, root.FindNode(identifier.Span, findInsideTrivia: true)); 717Assert.Equal(classDecl, root.FindNode(classDecl.Identifier.Span, findInsideTrivia: false)); 721Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia: false)); 722Assert.Equal(root, root.FindNode(EOFSpan, findInsideTrivia: true)); 726Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(EOFSpan)); 731Assert.Equal(classDecl2, root.FindNode(nodeEndPositionSpan, findInsideTrivia: false)); 732Assert.Equal(classDecl2, root.FindNode(nodeEndPositionSpan, findInsideTrivia: true)); 733Assert.Equal(classDecl2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia: false)); 734Assert.Equal(classDecl2, classDecl2.FindNode(nodeEndPositionSpan, findInsideTrivia: true)); 736Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(nodeEndPositionSpan)); 740Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 742Assert.Throws<ArgumentOutOfRangeException>(() => root.FindNode(invalidSpan)); 744Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 746Assert.Throws<ArgumentOutOfRangeException>(() => classDecl2.FindNode(invalidSpan)); 748Assert.Throws<ArgumentOutOfRangeException>(() => classDecl.FindNode(root.FullSpan));
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
LanguageServices\FixAllSpanMappingService\CSharpFixAllSpanMappingService.cs (1)
32var node = root.FindNode(span);
Simplification\CSharpSimplificationService.cs (1)
196if (root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4703var node = root.FindNode(span, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
CodeLens\AbstractCodeLensTest.cs (4)
36var declarationSyntaxNode = syntaxNode.FindNode(span); 65var declarationSyntaxNode = syntaxNode.FindNode(span); 93var declarationSyntaxNode = syntaxNode.FindNode(span); 121var declarationSyntaxNode = syntaxNode.FindNode(span);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (5)
CodeGeneration\CodeGenerationTests.cs (1)
900return SemanticModel.SyntaxTree.GetRoot().FindNode(destSpan, getInnermostNodeForTie: true);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (2)
959var attribute1 = root.FindNode(diagnostics[0].DataLocation.UnmappedFileSpan.GetClampedTextSpan(text)).ToString(); 961var attribute2 = root.FindNode(diagnostics[1].DataLocation.UnmappedFileSpan.GetClampedTextSpan(text)).ToString();
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
328var symbol = semanticModel.GetSymbolInfo(syntaxRoot.FindNode(testDocument.SelectedSpans.Single())).Symbol;
StackTraceExplorer\StackTraceExplorerTests.cs (1)
50var node = root.FindNode(selectedSpan);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
LanguageServices\SyntaxFactsServiceTests.vb (1)
212Dim node = root.FindNode(New TextSpan(cursorPosition, 0))
Microsoft.CodeAnalysis.Features (61)
AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
58var node = root.FindNode(span, getInnermostNodeForTie: true) as TExpressionSyntax;
AbstractAddDocCommentNodesCodeFixProvider.cs (1)
33var parentMethod = root.FindNode(context.Span).FirstAncestorOrSelf<TMemberDeclarationSyntax>();
AbstractAddExplicitCastCodeFixProvider.cs (2)
65var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) 202d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
AbstractAddParameterCodeFixProvider.cs (1)
59var initialNode = root.FindNode(diagnostic.Location.SourceSpan);
AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
38var diagnosticNode = root.FindNode(context.Span, getInnermostNodeForTie: true);
AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
AbstractForEachCastCodeFixProvider.cs (1)
51var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
50declarators.Add(root.FindNode(diagnosticSpan, getInnermostNodeForTie: true).FirstAncestorOrSelf<TSymbolSyntax>()!);
AbstractMakeTypePartialCodeFixProvider.cs (1)
37var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
55var paramNode = root.FindNode(span, findInsideTrivia: true);
AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
158var node = root.FindNode(context.Span, getInnermostNodeForTie: true); 390var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 666var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractSimplifyLinqExpressionCodeFixProvider`3.cs (1)
57return (TInvocationExpressionSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
AbstractUnsealClassCodeFixProvider.cs (1)
37var node = syntaxRoot.FindNode(context.Span, getInnermostNodeForTie: true);
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
71var objectCreation = (TObjectCreationExpressionSyntax)originalRoot.FindNode(
AbstractUseInferredMemberNameCodeFixProvider.cs (1)
39var node = root.FindNode(diagnostic.Location.SourceSpan);
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); 149var whenTrueStatement = (TStatementSyntax)root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 150var match = (TExpressionSyntax)root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan, getInnermostNodeForTie: true);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
69var objectCreation = (TObjectCreationExpressionSyntax)originalRoot.FindNode(
AddParameterService.cs (1)
111var methodNode = syntaxRoot.FindNode(methodDeclaration.Locations[0].SourceSpan, getInnermostNodeForTie: true);
ChangeSignature\AbstractChangeSignatureService.cs (1)
456var 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));
CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
353var selectionNode = root.FindNode(selectionTrimmed, getInnermostNodeForTie: true);
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (1)
38var node = root.FindNode(span);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
728var refNode = root.FindNode(refLoc.ReferenceLocation.Location.SourceSpan, findInsideTrivia: true, getInnermostNodeForTie: true);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
56root = root.ReplaceNode(root.FindNode(ifSpan, getInnermostNodeForTie: true), @switch);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
186var linkedFieldNode = linkedRoot.FindNode(fieldDeclaration.Span);
Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
139var firstParameterNode = (TParameterSyntax)root.FindNode(parameterSpan);
NamingStyleCodeFixProvider.cs (1)
61var node = root.FindNode(span);
RemoveRedundantEqualityCodeFixProvider.cs (1)
51var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (2)
37if (root.FindNode(diagnostic.Location.SourceSpan) != null) 48var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
43if (root.FindNode(diagnostic.Location.SourceSpan) is { } node && syntaxFacts.IsAttribute(node) || 80if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute &&
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)
148var closestNode = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractConstructorSnippetProvider.cs (1)
36var nodeAtPosition = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
242var closestNode = root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
49var node = syntaxRoot.FindNode(span);
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (2)
40var node = root.FindNode(textSpan, getInnermostNodeForTie: true); 82var innerMatch = root.FindNode(span, getInnermostNodeForTie: true);
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
68var ifOrElseIf = root.FindNode(ifOrElseIfSpan);
UpdateLegacySuppressionsCodeFixProvider.cs (2)
38root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) 49var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
55var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 56var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 57var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
67var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 68var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 69var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
ValueTracking\ValueTracker.cs (1)
259var selectedNode = root.FindNode(textSpan);
ValueTracking\ValueTracker.FindReferencesProgress.cs (2)
146var originalNode = syntaxRoot.FindNode(span); 169var originalNode = syntaxRoot.FindNode(span);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\CodeLensReferences\RemoteCodeLensReferencesService.cs (1)
40return syntaxRoot.FindNode(textSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.Test.Utilities (1)
MarkedSource\SourceWithMarkedNodes.cs (1)
122var node = root.FindNode(spanAndKindAndId.Item1, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
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)
VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
40Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (5)
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (2)
487Dim oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan) 509Dim newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan)
Formatting\CodeCleanUpTests.vb (3)
656Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan) 701Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan) 730Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan)
Microsoft.CodeAnalysis.VisualBasic.Features (3)
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.vb (1)
39Dim node = root.FindNode(context.Span, getInnermostNodeForTie:=True)
VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
40Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (18)
TestSyntaxNodes.vb (18)
2256Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=False)) 2257Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=True)) 2266Assert.Equal(classStatement, root.FindNode(identifier.Span, findInsideTrivia:=False)) 2267Assert.Equal(identifier.Parent, root.FindNode(identifier.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)
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 (7)
FindSymbols\SymbolFinder.cs (1)
284var linkedNode = linkedSyntaxRoot.FindNode(location.Span, getInnermostNodeForTie: true);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
243var node = root.FindNode(this.Span);
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);
ReassignedVariable\AbstractReassignedVariableService.cs (1)
56stack.Add(root.FindNode(span));
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.VisualStudio.LanguageServices (1)
CodeLens\CodeLensCallbackListener.cs (1)
165return (document.Id, root.FindNode(textSpan));
Microsoft.VisualStudio.LanguageServices.Implementation (1)
RoslynVisualStudioWorkspace.cs (1)
172var syntaxNode = tree.GetRoot().FindNode(sourceLocation.SourceSpan);
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
Venus\DocumentService_IntegrationTests.vb (1)
146Dim node = root.FindNode(originalDocument.AnnotatedSpans("Original").First()).AncestorsAndSelf().OfType(Of ClassDeclarationSyntax).First()