Click or drag to resize

SyntaxTree Class



The parsed representation of a source document.
Inheritance Hierarchy

Namespace:  Microsoft.CodeAnalysis
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public abstract class SyntaxTree

The SyntaxTree type exposes the following members.

Constructors
  NameDescription
Protected methodSyntaxTree
Initializes a new instance of the SyntaxTree class
Top
Properties
  NameDescription
Public propertyEncoding
The text encoding of the source document.
Public propertyFilePath
The path of the source document file.
Public propertyHasCompilationUnitRoot
Returns true if this syntax tree has a root with SyntaxKind "CompilationUnit".
Public propertyLength
The length of the text of the syntax tree.
Public propertyOptions
The options used by the parser to produce the syntax tree.
Protected propertyOptionsCore
The options used by the parser to produce the syntax tree.
Top
Methods
  NameDescription
Public methodGetChangedSpans
Public methodGetChanges
Public methodGetDiagnostics(Void)
Public methodGetLineSpan
Gets the location in terms of path, line and column for a given span.
Public methodGetLineVisibility
Returns the visibility for the line at the given position.
Public methodGetLocation
Gets a location for the specified text span.
Public methodGetMappedLineSpan
Gets the location in terms of path, line and column after applying source line mapping directives (
#line
in C# or
#ExternalSource
in VB).
Public methodGetReference
Gets a SyntaxReference for a specified syntax node. SyntaxReferences can be used to regain access to a syntax node without keeping the entire tree and source text in memory.
Public methodGetRoot
Gets the root node of the syntax tree, causing computation if necessary.
Public methodGetRootAsync
Protected methodGetRootAsyncCore
Protected methodGetRootCore
Gets the root node of the syntax tree, causing computation if necessary.
Public methodGetText
Gets the text of the source document.
Public methodGetTextAsync
Public methodHasHiddenRegions
Are there any hidden regions in the tree?
Public methodIsEquivalentTo
Determines if two trees are the same, disregarding trivia differences.
Public methodToString
Returns a String that represents the entire source text of this SyntaxTree.
Public methodTryGetRoot
Gets the root of the syntax tree if it is available.
Protected methodTryGetRootCore
Gets the root of the syntax tree if it is available.
Public methodTryGetText
Gets the syntax tree's text if it is available.
Public methodWithChangedText
Create a new syntax tree based off this tree using a new source text. If the new source text is a minor change from the current source text an incremental parse will occur reusing most of the current syntax tree internal data. Otherwise, a full parse will occur using the new source text.
Public methodWithFilePath
Returns a new tree whose FilePath is the specified node and other properties are copied from the current tree.
Public methodWithRootAndOptions
Returns a new tree whose root and options are as specified and other properties are copied from the current tree.
Top
Extension Methods
  NameDescription
Public Extension MethodGetCompilationUnitRootOverloaded.
Gets the root CompilationUnitSyntax for a specified SyntaxTree.
(Defined by VisualBasicExtensions.)
Public Extension MethodGetCompilationUnitRoot(CancellationToken)Overloaded. (Defined by CSharpExtensions.)
Top
See Also