Delen via


SourceGeneratedDocument Class

Definition

A Document that was generated by an ISourceGenerator.

public sealed class SourceGeneratedDocument : Microsoft.CodeAnalysis.Document
type SourceGeneratedDocument = class
    inherit Document
Public NotInheritable Class SourceGeneratedDocument
Inherits Document
Inheritance
SourceGeneratedDocument

Properties

FilePath

The path to the document file or null if there is no document file.

(Inherited from TextDocument)
Folders

The sequence of logical folders the document is contained in.

(Inherited from TextDocument)
HintName
Id

The document's identifier. Many document instances may share the same ID, but only one document in a solution may have that ID.

(Inherited from TextDocument)
Name

The name of the document.

(Inherited from TextDocument)
Project

The project this document belongs to.

(Inherited from TextDocument)
SourceCodeKind

The kind of source code this document contains.

(Inherited from Document)
SupportsSemanticModel

true if this Document supports providing data through the GetSemanticModelAsync(CancellationToken) method.

If false then that method will return null instead.

(Inherited from Document)
SupportsSyntaxTree

true if this Document supports providing data through the GetSyntaxTreeAsync(CancellationToken) and GetSyntaxRootAsync(CancellationToken) methods.

If false then these methods will return null instead.

(Inherited from Document)

Methods

GetLinkedDocumentIds()

Gets the list of DocumentIds that are linked to this Document. Documents are considered to be linked if they share the same FilePath. This DocumentId is excluded from the result.

(Inherited from Document)
GetOptionsAsync(CancellationToken)

Returns the options that should be applied to this document. This consists of global options from Options, merged with any settings the user has specified at the document levels.

(Inherited from Document)
GetSemanticModelAsync(CancellationToken)

Gets the semantic model for this document asynchronously.

(Inherited from Document)
GetSyntaxRootAsync(CancellationToken)

Gets the root node of the syntax tree asynchronously.

(Inherited from Document)
GetSyntaxTreeAsync(CancellationToken)

Gets the SyntaxTree for this document asynchronously.

(Inherited from Document)
GetSyntaxVersionAsync(CancellationToken)

Gets the version of the syntax tree. This is generally the newer of the text version and the project's version.

(Inherited from Document)
GetTextAsync(CancellationToken)

Gets the current text for the document asynchronously.

(Inherited from TextDocument)
GetTextChangesAsync(Document, CancellationToken)

Get the text changes between this document and a prior version of the same document. The changes, when applied to the text of the old document, will produce the text of the current document.

(Inherited from Document)
GetTextVersionAsync(CancellationToken)

Gets the version of the document's text.

(Inherited from TextDocument)
TryGetSemanticModel(SemanticModel)

Gets the current semantic model for this document if the model is already computed and still cached. In almost all cases, you should call GetSemanticModelAsync(CancellationToken), which will compute the semantic model if necessary.

(Inherited from Document)
TryGetSyntaxRoot(SyntaxNode)

Gets the root node of the current syntax tree if the syntax tree has already been parsed and the tree is still cached. In almost all cases, you should call GetSyntaxRootAsync(CancellationToken) to fetch the root node, which will parse the document if necessary.

(Inherited from Document)
TryGetSyntaxTree(SyntaxTree)

Get the current syntax tree for the document if the text is already loaded and the tree is already parsed. In almost all cases, you should call GetSyntaxTreeAsync(CancellationToken) to fetch the tree, which will parse the tree if it's not already parsed.

(Inherited from Document)
TryGetSyntaxVersion(VersionStamp)

Get the current syntax tree version for the document if the text is already loaded and the tree is already parsed. In almost all cases, you should call GetSyntaxVersionAsync(CancellationToken) to fetch the version, which will load the tree if it's not already available.

(Inherited from Document)
TryGetText(SourceText)

Get the current text for the document if it is already loaded and available.

(Inherited from TextDocument)
TryGetTextVersion(VersionStamp)

Gets the version of the document's text if it is already loaded and available.

(Inherited from TextDocument)
WithFilePath(String)

Creates a new instance of this document updated to have the specified file path.

(Inherited from Document)
WithFolders(IEnumerable<String>)

Creates a new instance of this document updated to have the specified folders.

(Inherited from Document)
WithName(String)

Creates a new instance of this document updated to have the specified name.

(Inherited from Document)
WithSourceCodeKind(SourceCodeKind)

Creates a new instance of this document updated to have the source code kind specified.

(Inherited from Document)
WithSyntaxRoot(SyntaxNode)

Creates a new instance of this document updated to have a syntax tree rooted by the specified syntax node.

(Inherited from Document)
WithText(SourceText)

Creates a new instance of this document updated to have the text specified.

(Inherited from Document)

Applies to