Search Results for

    Show / Hide Table of Contents

    Class SyntaxNode

    Represents a non-terminal node in the syntax tree.

    Inheritance
    System.Object
    SyntaxNode
    LuaSyntaxNode
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Loretta.CodeAnalysis
    Assembly: Loretta.CodeAnalysis.dll
    Syntax
    public abstract class SyntaxNode

    Properties

    | Improve this Doc View Source

    ContainsAnnotations

    Determines whether this node or any sub node, token or trivia has annotations.

    Declaration
    public bool ContainsAnnotations { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ContainsDiagnostics

    Determines whether this node or any of its descendant nodes, tokens or trivia have any diagnostics on them.

    Declaration
    public bool ContainsDiagnostics { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ContainsDirectives

    Determines whether this node has any descendant preprocessor directives.

    Declaration
    public bool ContainsDirectives { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ContainsSkippedText

    Determines whether this node has any descendant skipped text.

    Declaration
    public bool ContainsSkippedText { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    FullSpan

    The absolute span of this node in characters, including its leading and trailing trivia.

    Declaration
    public TextSpan FullSpan { get; }
    Property Value
    Type Description
    TextSpan
    | Improve this Doc View Source

    HasLeadingTrivia

    Determines whether this node has any leading trivia.

    Declaration
    public bool HasLeadingTrivia { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    HasStructuredTrivia

    Determines whether a descendant trivia of this node is structured.

    Declaration
    public bool HasStructuredTrivia { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    HasTrailingTrivia

    Determines whether this node has any trailing trivia.

    Declaration
    public bool HasTrailingTrivia { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsMissing

    Determines whether the node represents a language construct that was actually parsed from the source code. Missing nodes are generated by the parser in error scenarios to represent constructs that should have been present in the source code in order to compile successfully but were actually missing.

    Declaration
    public bool IsMissing { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsStructuredTrivia

    Determines whether this node represents a structured trivia.

    Declaration
    public bool IsStructuredTrivia { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Language

    The language name that this node is syntax of.

    Declaration
    public abstract string Language { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Parent

    The node that contains this node in its ChildNodes() collection.

    Declaration
    public SyntaxNode Parent { get; }
    Property Value
    Type Description
    SyntaxNode
    | Improve this Doc View Source

    ParentTrivia

    The parent trivia for this node in case it is part of structured trivia.

    Declaration
    public virtual SyntaxTrivia ParentTrivia { get; }
    Property Value
    Type Description
    SyntaxTrivia
    | Improve this Doc View Source

    RawKind

    An integer representing the language specific kind of this node.

    Declaration
    public int RawKind { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Span

    The absolute span of this node in characters, not including its leading and trailing trivia.

    Declaration
    public TextSpan Span { get; }
    Property Value
    Type Description
    TextSpan
    | Improve this Doc View Source

    SpanStart

    Same as accessing Start on Span.

    Declaration
    public int SpanStart { get; }
    Property Value
    Type Description
    System.Int32
    Remarks

    Slight performance improvement.

    | Improve this Doc View Source

    SyntaxTree

    Returns SyntaxTree that owns the node or null if node does not belong to a SyntaxTree

    Declaration
    public SyntaxTree SyntaxTree { get; }
    Property Value
    Type Description
    SyntaxTree

    Methods

    | Improve this Doc View Source

    Ancestors(Boolean)

    Gets a list of ancestor nodes

    Declaration
    public IEnumerable<SyntaxNode> Ancestors(bool ascendOutOfTrivia = true)
    Parameters
    Type Name Description
    System.Boolean ascendOutOfTrivia
    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    AncestorsAndSelf(Boolean)

    Gets a list of ancestor nodes (including this node)

    Declaration
    public IEnumerable<SyntaxNode> AncestorsAndSelf(bool ascendOutOfTrivia = true)
    Parameters
    Type Name Description
    System.Boolean ascendOutOfTrivia
    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    ChildNodes()

    Gets a list of the child nodes in prefix document order.

    Declaration
    public IEnumerable<SyntaxNode> ChildNodes()
    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    ChildNodesAndTokens()

    The list of child nodes and tokens of this node, where each element is a SyntaxNodeOrToken instance.

    Declaration
    public ChildSyntaxList ChildNodesAndTokens()
    Returns
    Type Description
    ChildSyntaxList
    | Improve this Doc View Source

    ChildThatContainsPosition(Int32)

    Returns the child node or token that contains the provided position.

    Declaration
    public virtual SyntaxNodeOrToken ChildThatContainsPosition(int position)
    Parameters
    Type Name Description
    System.Int32 position
    Returns
    Type Description
    SyntaxNodeOrToken
    | Improve this Doc View Source

    ChildTokens()

    Gets a list of the direct child tokens of this node.

    Declaration
    public IEnumerable<SyntaxToken> ChildTokens()
    Returns
    Type Description
    IEnumerable<SyntaxToken>
    | Improve this Doc View Source

    Contains(SyntaxNode)

    Determines if the specified node is a descendant of this node. Returns true for current node.

    Declaration
    public bool Contains(SyntaxNode node)
    Parameters
    Type Name Description
    SyntaxNode node
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    CopyAnnotationsTo<T>(T)

    Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on node.

    Declaration
    public T CopyAnnotationsTo<T>(T node)
        where T : SyntaxNode
    Parameters
    Type Name Description
    T node
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    Remarks

    If no annotations are copied, just returns node.

    It can also be used manually to preserve annotations in a more complex tree modification, even if the type of a node changes.

    | Improve this Doc View Source

    DescendantNodes(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes in prefix document order.

    Declaration
    public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span

    The span the node's full span must intersect.

    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    DescendantNodes(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes in prefix document order.

    Declaration
    public IEnumerable<SyntaxNode> DescendantNodes(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    DescendantNodesAndSelf(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes (including this node) in prefix document order.

    Declaration
    public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span

    The span the node's full span must intersect.

    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    DescendantNodesAndSelf(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes (including this node) in prefix document order.

    Declaration
    public IEnumerable<SyntaxNode> DescendantNodesAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    DescendantNodesAndTokens(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of the descendant nodes and tokens in prefix document order.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span

    The span the node's full span must intersect.

    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    DescendantNodesAndTokens(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes and tokens in prefix document order.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    DescendantNodesAndTokensAndSelf(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of the descendant nodes and tokens (including this node) in prefix document order.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span

    The span the node's full span must intersect.

    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    DescendantNodesAndTokensAndSelf(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of descendant nodes and tokens (including this node) in prefix document order.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren

    An optional function that determines if the search descends into the argument node's children.

    System.Boolean descendIntoTrivia

    Determines if nodes that are part of structured trivia are included in the list.

    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    DescendantTokens(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of all the tokens in the full span of this node.

    Declaration
    public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren
    System.Boolean descendIntoTrivia
    Returns
    Type Description
    IEnumerable<SyntaxToken>
    | Improve this Doc View Source

    DescendantTokens(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Gets a list of all the tokens in the span of this node.

    Declaration
    public IEnumerable<SyntaxToken> DescendantTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren
    System.Boolean descendIntoTrivia
    Returns
    Type Description
    IEnumerable<SyntaxToken>
    | Improve this Doc View Source

    DescendantTrivia(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Get a list of all the trivia associated with the descendant nodes and tokens.

    Declaration
    public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    TextSpan span
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren
    System.Boolean descendIntoTrivia
    Returns
    Type Description
    IEnumerable<SyntaxTrivia>
    | Improve this Doc View Source

    DescendantTrivia(Nullable<Func<SyntaxNode, Boolean>>, Boolean)

    Get a list of all the trivia associated with the descendant nodes and tokens.

    Declaration
    public IEnumerable<SyntaxTrivia> DescendantTrivia(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
    Parameters
    Type Name Description
    System.Nullable<Func<SyntaxNode, System.Boolean>> descendIntoChildren
    System.Boolean descendIntoTrivia
    Returns
    Type Description
    IEnumerable<SyntaxTrivia>
    | Improve this Doc View Source

    FindNode(TextSpan, Boolean, Boolean)

    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.

    Declaration
    public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false)
    Parameters
    Type Name Description
    TextSpan span
    System.Boolean findInsideTrivia
    System.Boolean getInnermostNodeForTie
    Returns
    Type Description
    SyntaxNode
    | Improve this Doc View Source

    FindToken(Int32, Boolean)

    Finds a descendant token of this node whose span includes the supplied position.

    Declaration
    public SyntaxToken FindToken(int position, bool findInsideTrivia = false)
    Parameters
    Type Name Description
    System.Int32 position

    The character position of the token relative to the beginning of the file.

    System.Boolean findInsideTrivia

    True to return tokens that are part of trivia. If false finds the token whose full span (including trivia) includes the position.

    Returns
    Type Description
    SyntaxToken
    | Improve this Doc View Source

    FindTrivia(Int32, Boolean)

    Finds a descendant trivia of this node whose span includes the supplied position.

    Declaration
    public SyntaxTrivia FindTrivia(int position, bool findInsideTrivia = false)
    Parameters
    Type Name Description
    System.Int32 position

    The character position of the trivia relative to the beginning of the file.

    System.Boolean findInsideTrivia

    True to return tokens that are part of trivia. If false finds the token whose full span (including trivia) includes the position.

    Returns
    Type Description
    SyntaxTrivia
    | Improve this Doc View Source

    FindTrivia(Int32, Nullable<Func<SyntaxTrivia, Boolean>>)

    Finds a descendant trivia of this node at the specified position, where the position is within the span of the node.

    Declaration
    public SyntaxTrivia FindTrivia(int position, Func<SyntaxTrivia, bool>? stepInto)
    Parameters
    Type Name Description
    System.Int32 position

    The character position of the trivia relative to the beginning of the file.

    System.Nullable<Func<SyntaxTrivia, System.Boolean>> stepInto

    Specifies a function that determines per trivia node, whether to descend into structured trivia of that node.

    Returns
    Type Description
    SyntaxTrivia
    | Improve this Doc View Source

    FirstAncestorOrSelf<TNode>(Nullable<Func<TNode, Boolean>>, Boolean)

    Gets the first node of type TNode that matches the predicate.

    Declaration
    public TNode FirstAncestorOrSelf<TNode>(Func<TNode, bool>? predicate = null, bool ascendOutOfTrivia = true)
        where TNode : SyntaxNode
    Parameters
    Type Name Description
    System.Nullable<Func<TNode, System.Boolean>> predicate
    System.Boolean ascendOutOfTrivia
    Returns
    Type Description
    TNode
    Type Parameters
    Name Description
    TNode
    | Improve this Doc View Source

    FirstAncestorOrSelf<TNode, TArg>(Func<TNode, TArg, Boolean>, TArg, Boolean)

    Gets the first node of type TNode that matches the predicate.

    Declaration
    public TNode FirstAncestorOrSelf<TNode, TArg>(Func<TNode, TArg, bool> predicate, TArg argument, bool ascendOutOfTrivia = true)
        where TNode : SyntaxNode
    Parameters
    Type Name Description
    Func<TNode, TArg, System.Boolean> predicate
    TArg argument
    System.Boolean ascendOutOfTrivia
    Returns
    Type Description
    TNode
    Type Parameters
    Name Description
    TNode
    TArg
    | Improve this Doc View Source

    GetAnnotatedNodes(SyntaxAnnotation)

    Gets all nodes with the specified annotation.

    Declaration
    public IEnumerable<SyntaxNode> GetAnnotatedNodes(SyntaxAnnotation syntaxAnnotation)
    Parameters
    Type Name Description
    SyntaxAnnotation syntaxAnnotation
    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    GetAnnotatedNodes(String)

    Gets all nodes with the specified annotation kind.

    Declaration
    public IEnumerable<SyntaxNode> GetAnnotatedNodes(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    IEnumerable<SyntaxNode>
    | Improve this Doc View Source

    GetAnnotatedNodesAndTokens(SyntaxAnnotation)

    Gets all nodes and tokens with the specified annotation.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxAnnotation annotation)
    Parameters
    Type Name Description
    SyntaxAnnotation annotation
    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    GetAnnotatedNodesAndTokens(String)

    Gets all nodes and tokens with an annotation of the specified annotation kind.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    GetAnnotatedNodesAndTokens(String[])

    Gets all nodes and tokens with an annotation of the specified annotation kinds.

    Declaration
    public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(params string[] annotationKinds)
    Parameters
    Type Name Description
    System.String[] annotationKinds
    Returns
    Type Description
    IEnumerable<SyntaxNodeOrToken>
    | Improve this Doc View Source

    GetAnnotatedTokens(SyntaxAnnotation)

    Gets all tokens with the specified annotation.

    Declaration
    public IEnumerable<SyntaxToken> GetAnnotatedTokens(SyntaxAnnotation syntaxAnnotation)
    Parameters
    Type Name Description
    SyntaxAnnotation syntaxAnnotation
    Returns
    Type Description
    IEnumerable<SyntaxToken>
    | Improve this Doc View Source

    GetAnnotatedTokens(String)

    Gets all tokens with the specified annotation kind.

    Declaration
    public IEnumerable<SyntaxToken> GetAnnotatedTokens(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    IEnumerable<SyntaxToken>
    | Improve this Doc View Source

    GetAnnotatedTrivia(SyntaxAnnotation)

    Gets all trivia with the specified annotation.

    Declaration
    public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(SyntaxAnnotation annotation)
    Parameters
    Type Name Description
    SyntaxAnnotation annotation
    Returns
    Type Description
    IEnumerable<SyntaxTrivia>
    | Improve this Doc View Source

    GetAnnotatedTrivia(String)

    Gets all trivia with an annotation of the specified annotation kind.

    Declaration
    public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    IEnumerable<SyntaxTrivia>
    | Improve this Doc View Source

    GetAnnotatedTrivia(String[])

    Gets all trivia with an annotation of the specified annotation kinds.

    Declaration
    public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(params string[] annotationKinds)
    Parameters
    Type Name Description
    System.String[] annotationKinds
    Returns
    Type Description
    IEnumerable<SyntaxTrivia>
    | Improve this Doc View Source

    GetAnnotations(IEnumerable<String>)

    Gets all the annotations with the specified annotation kinds.

    Declaration
    public IEnumerable<SyntaxAnnotation> GetAnnotations(IEnumerable<string> annotationKinds)
    Parameters
    Type Name Description
    IEnumerable<System.String> annotationKinds
    Returns
    Type Description
    IEnumerable<SyntaxAnnotation>
    | Improve this Doc View Source

    GetAnnotations(String)

    Gets all the annotations with the specified annotation kind.

    Declaration
    public IEnumerable<SyntaxAnnotation> GetAnnotations(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    IEnumerable<SyntaxAnnotation>
    | Improve this Doc View Source

    GetDiagnostics()

    Gets a list of all the diagnostics in the sub tree that has this node as its root. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc.

    Declaration
    public IEnumerable<Diagnostic> GetDiagnostics()
    Returns
    Type Description
    IEnumerable<Diagnostic>
    | Improve this Doc View Source

    GetFirstToken(Boolean, Boolean, Boolean, Boolean)

    Gets the first token of the tree rooted by this node. Skips zero-width tokens.

    Declaration
    public SyntaxToken GetFirstToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
    Parameters
    Type Name Description
    System.Boolean includeZeroWidth
    System.Boolean includeSkipped
    System.Boolean includeDirectives
    System.Boolean includeDocumentationComments
    Returns
    Type Description
    SyntaxToken

    The first token or default(SyntaxToken) if it doesn't exist.

    | Improve this Doc View Source

    GetLastToken(Boolean, Boolean, Boolean, Boolean)

    Gets the last token of the tree rooted by this node. Skips zero-width tokens.

    Declaration
    public SyntaxToken GetLastToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
    Parameters
    Type Name Description
    System.Boolean includeZeroWidth
    System.Boolean includeSkipped
    System.Boolean includeDirectives
    System.Boolean includeDocumentationComments
    Returns
    Type Description
    SyntaxToken

    The last token or default(SyntaxToken) if it doesn't exist.

    | Improve this Doc View Source

    GetLeadingTrivia()

    The list of trivia that appears before this node in the source code and are attached to a token that is a descendant of this node.

    Declaration
    public SyntaxTriviaList GetLeadingTrivia()
    Returns
    Type Description
    SyntaxTriviaList
    | Improve this Doc View Source

    GetLocation()

    Returns the Location for this node.

    Declaration
    public Location GetLocation()
    Returns
    Type Description
    Location
    | Improve this Doc View Source

    GetReference()

    Gets a SyntaxReference for this syntax node. CommonSyntaxReferences can be used to regain access to a syntax node without keeping the entire tree and source text in memory.

    Declaration
    public SyntaxReference GetReference()
    Returns
    Type Description
    SyntaxReference
    | Improve this Doc View Source

    GetText(Encoding, SourceHashAlgorithm)

    Gets the full text of this node as a new SourceText instance.

    Declaration
    public SourceText GetText(Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
    Parameters
    Type Name Description
    System.Text.Encoding encoding

    Encoding of the file that the text was read from or is going to be saved to. null if the encoding is unspecified. If the encoding is not specified the SourceText isn't debuggable. If an encoding-less SourceText is written to a file a System.Text.Encoding.UTF8 shall be used as a default.

    SourceHashAlgorithm checksumAlgorithm

    Hash algorithm to use to calculate checksum of the text that's saved to PDB.

    Returns
    Type Description
    SourceText
    | Improve this Doc View Source

    GetTrailingTrivia()

    The list of trivia that appears after this node in the source code and are attached to a token that is a descendant of this node.

    Declaration
    public SyntaxTriviaList GetTrailingTrivia()
    Returns
    Type Description
    SyntaxTriviaList
    | Improve this Doc View Source

    HasAnnotation(SyntaxAnnotation)

    Determines whether this node has the specific annotation.

    Declaration
    public bool HasAnnotation(SyntaxAnnotation annotation)
    Parameters
    Type Name Description
    SyntaxAnnotation annotation
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    HasAnnotations(IEnumerable<String>)

    Determines whether this node has any annotations with any of the specific annotation kinds.

    Declaration
    public bool HasAnnotations(IEnumerable<string> annotationKinds)
    Parameters
    Type Name Description
    IEnumerable<System.String> annotationKinds
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    HasAnnotations(String)

    Determines whether this node has any annotations with the specific annotation kind.

    Declaration
    public bool HasAnnotations(string annotationKind)
    Parameters
    Type Name Description
    System.String annotationKind
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsEquivalentTo(SyntaxNode)

    Determine whether this node is structurally equivalent to another.

    Declaration
    public bool IsEquivalentTo(SyntaxNode other)
    Parameters
    Type Name Description
    SyntaxNode other
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsEquivalentTo(SyntaxNode, Boolean)

    Determines if two nodes are the same, disregarding trivia differences.

    Declaration
    public bool IsEquivalentTo(SyntaxNode node, bool topLevel = false)
    Parameters
    Type Name Description
    SyntaxNode node

    The node to compare against.

    System.Boolean topLevel

    If true then the nodes are equivalent if the contained nodes and tokens declaring metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies or initializer expressions, otherwise all nodes and tokens must be equivalent.

    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsIncrementallyIdenticalTo(SyntaxNode)

    Returns true if these two nodes are considered "incrementally identical". An incrementally identical node occurs when a SyntaxTree is incrementally parsed using WithChangedText(SourceText) and the incremental parser is able to take the node from the original tree and use it in its entirety in the new tree. In this case, the ToFullString() of each node will be the same, though they could have different parents, and may occur at different positions in their respective trees. If two nodes are incrementally identical, all children of each node will be incrementally identical as well.

    Declaration
    public bool IsIncrementallyIdenticalTo(SyntaxNode other)
    Parameters
    Type Name Description
    SyntaxNode other
    Returns
    Type Description
    System.Boolean
    Remarks

    Incrementally identical nodes can also appear within the same syntax tree, or syntax trees that did not arise from WithChangedText(SourceText). This can happen as the parser is allowed to construct parse trees from shared nodes for efficiency. In all these cases though, it will still remain true that the incrementally identical nodes could have different parents and may occur at different positions in their respective trees.

    | Improve this Doc View Source

    IsPartOfStructuredTrivia()

    Determines whether this node is a descendant of a structured trivia.

    Declaration
    public bool IsPartOfStructuredTrivia()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    SerializeTo(Stream, CancellationToken)

    Serializes the node to the given stream. Leaves the stream open for further writes.

    Declaration
    public virtual void SerializeTo(Stream stream, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    Stream stream
    CancellationToken cancellationToken
    | Improve this Doc View Source

    ToFullString()

    Returns full string representation of this node including its leading and trailing trivia.

    Declaration
    public virtual string ToFullString()
    Returns
    Type Description
    System.String

    The full string representation of this node including its leading and trailing trivia.

    Remarks

    The length of the returned string is always the same as FullSpan.Length

    | Improve this Doc View Source

    ToString()

    Returns the string representation of this node, not including its leading and trailing trivia.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    The string representation of this node, not including its leading and trailing trivia.

    Overrides
    System.Object.ToString()
    Remarks

    The length of the returned string is always the same as Span.Length

    | Improve this Doc View Source

    WriteTo(TextWriter)

    Writes the full text of this node to the specified .

    Declaration
    public virtual void WriteTo(TextWriter writer)
    Parameters
    Type Name Description
    TextWriter writer

    Extension Methods

    AnnotationExtensions.WithAdditionalAnnotations<TNode>(TNode, SyntaxAnnotation[])
    AnnotationExtensions.WithAdditionalAnnotations<TNode>(TNode, IEnumerable<SyntaxAnnotation>)
    AnnotationExtensions.WithoutAnnotations<TNode>(TNode, SyntaxAnnotation[])
    AnnotationExtensions.WithoutAnnotations<TNode>(TNode, IEnumerable<SyntaxAnnotation>)
    AnnotationExtensions.WithoutAnnotations<TNode>(TNode, String)
    SyntaxNodeExtensions.ReplaceSyntax<TRoot>(TRoot, IEnumerable<SyntaxNode>, Func<SyntaxNode, SyntaxNode, SyntaxNode>, IEnumerable<SyntaxToken>, Func<SyntaxToken, SyntaxToken, SyntaxToken>, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia, SyntaxTrivia, SyntaxTrivia>)
    SyntaxNodeExtensions.ReplaceNodes<TRoot, TNode>(TRoot, IEnumerable<TNode>, Func<TNode, TNode, SyntaxNode>)
    SyntaxNodeExtensions.ReplaceNode<TRoot>(TRoot, SyntaxNode, SyntaxNode)
    SyntaxNodeExtensions.ReplaceNode<TRoot>(TRoot, SyntaxNode, IEnumerable<SyntaxNode>)
    SyntaxNodeExtensions.InsertNodesBefore<TRoot>(TRoot, SyntaxNode, IEnumerable<SyntaxNode>)
    SyntaxNodeExtensions.InsertNodesAfter<TRoot>(TRoot, SyntaxNode, IEnumerable<SyntaxNode>)
    SyntaxNodeExtensions.ReplaceToken<TRoot>(TRoot, SyntaxToken, IEnumerable<SyntaxToken>)
    SyntaxNodeExtensions.InsertTokensBefore<TRoot>(TRoot, SyntaxToken, IEnumerable<SyntaxToken>)
    SyntaxNodeExtensions.InsertTokensAfter<TRoot>(TRoot, SyntaxToken, IEnumerable<SyntaxToken>)
    SyntaxNodeExtensions.ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, IEnumerable<SyntaxTrivia>)
    SyntaxNodeExtensions.InsertTriviaBefore<TRoot>(TRoot, SyntaxTrivia, IEnumerable<SyntaxTrivia>)
    SyntaxNodeExtensions.InsertTriviaAfter<TRoot>(TRoot, SyntaxTrivia, IEnumerable<SyntaxTrivia>)
    SyntaxNodeExtensions.ReplaceTokens<TRoot>(TRoot, IEnumerable<SyntaxToken>, Func<SyntaxToken, SyntaxToken, SyntaxToken>)
    SyntaxNodeExtensions.ReplaceToken<TRoot>(TRoot, SyntaxToken, SyntaxToken)
    SyntaxNodeExtensions.ReplaceTrivia<TRoot>(TRoot, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia, SyntaxTrivia, SyntaxTrivia>)
    SyntaxNodeExtensions.ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, SyntaxTrivia)
    SyntaxNodeExtensions.RemoveNode<TRoot>(TRoot, SyntaxNode, SyntaxRemoveOptions)
    SyntaxNodeExtensions.RemoveNodes<TRoot>(TRoot, IEnumerable<SyntaxNode>, SyntaxRemoveOptions)
    SyntaxNodeExtensions.NormalizeWhitespace<TNode>(TNode, String, Boolean)
    SyntaxNodeExtensions.NormalizeWhitespace<TNode>(TNode, String, String, Boolean)
    SyntaxNodeExtensions.WithTriviaFrom<TSyntax>(TSyntax, SyntaxNode)
    SyntaxNodeExtensions.WithoutTrivia<TSyntax>(TSyntax)
    SyntaxNodeExtensions.WithLeadingTrivia<TSyntax>(TSyntax, SyntaxTriviaList)
    SyntaxNodeExtensions.WithLeadingTrivia<TSyntax>(TSyntax, Nullable<IEnumerable<SyntaxTrivia>>)
    SyntaxNodeExtensions.WithoutLeadingTrivia<TSyntax>(TSyntax)
    SyntaxNodeExtensions.WithLeadingTrivia<TSyntax>(TSyntax, SyntaxTrivia[])
    SyntaxNodeExtensions.WithTrailingTrivia<TSyntax>(TSyntax, SyntaxTriviaList)
    SyntaxNodeExtensions.WithTrailingTrivia<TSyntax>(TSyntax, Nullable<IEnumerable<SyntaxTrivia>>)
    SyntaxNodeExtensions.WithoutTrailingTrivia<TSyntax>(TSyntax)
    SyntaxNodeExtensions.WithTrailingTrivia<TSyntax>(TSyntax, SyntaxTrivia[])
    SyntaxNodeExtensions.TrackNodes<TRoot>(TRoot, IEnumerable<SyntaxNode>)
    SyntaxNodeExtensions.TrackNodes<TRoot>(TRoot, SyntaxNode[])
    SyntaxNodeExtensions.GetCurrentNodes<TNode>(SyntaxNode, TNode)
    SyntaxNodeExtensions.GetCurrentNode<TNode>(SyntaxNode, TNode)
    SyntaxNodeExtensions.GetCurrentNodes<TNode>(SyntaxNode, IEnumerable<TNode>)
    LuaExtensions.IsKind(SyntaxNode, SyntaxKind)
    LuaExtensions.Kind(SyntaxNode)
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾