Delen via


SyntaxNode.FindNode(TextSpan, Boolean, Boolean) Method

Definition

Finds the node with the smallest FullSpan that contains span. getInnermostNodeForTie is used to determine the behavior in case of a tie (i.e. a node having the same span as its parent). If getInnermostNodeForTie is true, then it returns lowest descending node encompassing the given span. Otherwise, it returns the outermost node encompassing the given span.

public Microsoft.CodeAnalysis.SyntaxNode FindNode (Microsoft.CodeAnalysis.Text.TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false);
member this.FindNode : Microsoft.CodeAnalysis.Text.TextSpan * bool * bool -> Microsoft.CodeAnalysis.SyntaxNode
Public Function FindNode (span As TextSpan, Optional findInsideTrivia As Boolean = false, Optional getInnermostNodeForTie As Boolean = false) As SyntaxNode

Parameters

span
TextSpan
findInsideTrivia
Boolean
getInnermostNodeForTie
Boolean

Returns

Exceptions

This exception is thrown if FullSpan doesn't contain the given span.

Remarks

TODO: This should probably be reimplemented with ChildThatContainsPosition(Int32)

Applies to