CompilationUnitManager Class

Definition

Compilation unit manager.

public class CompilationUnitManager : IDisposable
type CompilationUnitManager = class
    interface IDisposable
Public Class CompilationUnitManager
Implements IDisposable
Inheritance
CompilationUnitManager
Implements

Remarks

This class intentionally does not give access to any FileContentManager that it manages, since it is responsible for coordinating access to (any routine of) the FileContentManager.

Constructors

CompilationUnitManager(ProjectProperties, Action<Exception>, Action<String,MessageType>, Action<PublishDiagnosticParams>, Boolean)

Initializes a CompilationUnitManager instance for a project with the given properties.

Properties

Log

General purpose logging routine.

LogException

Used to log exceptions raised during processing.

Processing

Used to synchronously execute all write access.

PublishDiagnostics

Called whenever diagnostics within a file have changed and are ready for publishing.

Methods

AddOrUpdateSourceFileAsync(FileContentManager, String)

Adds file to this compilation unit, adapting the diagnostics for all remaining files as needed.

AddOrUpdateSourceFilesAsync(ImmutableHashSet<FileContentManager>, Boolean)

Adds files to this compilation unit, adapting the diagnostics for all remaining files as needed.

Build()

Returns a CompilationUnitManager.Compilation containing all information about the current state of the compilation.

Dispose()

Cancels any ongoing type checking, waits for all queued tasks to finish, and then disposes disposable content initialized within this CompilationUnitManager (in particular disposes the CompilationUnitManager.Compilation).

FileContentInMemory(TextDocumentIdentifier)

Gets the current file content (text representation) in memory.

FlushAndExecute<T>(Func<T>)

Cancels any asynchronously running ongoing global type checking. After all currently queued tasks have finished, locks all processing, flushes the unprocessed changes in each source file, synchronously runs a global type checking (unless verifications are disabled), and then executes execute, returning its result.

Formatting(TextDocumentIdentifier, Boolean, Boolean, Int32)

Returns the edits to format the file according to the specified settings.

GetDiagnostics(TextDocumentIdentifier)

Get all current diagnostics.

GetFileId(Uri)

Converts a URI into the file ID used during compilation if the URI is an absolute file URI.

GetSourceFiles()

Returns a sequence of all source files that are currently contained in this compilation unit.

GetSyntaxTree()

Returns the syntax tree for the current state of the compilation.

GetTokenization(TextDocumentIdentifier)

Gets the current tokenization of the file content in memory. Each returned array item contains the array of tokens on the line with the corresponding index.

InitializeFileManager(Uri, String, Action<PublishDiagnosticParams>, Action<Exception>)

Initializes a FileContentManager for document uri with fileContent.

InitializeFileManagers(IDictionary<Uri,String>, Action<PublishDiagnosticParams>, Action<Exception>)

Initializes a FileContentManager for each entry in files and their contents.

Rename(RenameParams)

Returns the workspace edit that describes the changes to be done if the symbol at the given position - if any - is renamed to the given name.

SourceFileDidChangeAsync(DidChangeTextDocumentParams)

Modifies the compilation and all diagnostics to reflect the given change.

TryGetFileId(Uri, String)
Obsolete.

Converts a URI into the file ID used during compilation if the URI is an absolute file URI.

TryGetUri(String, Uri)

Returns the URI based on which fileId was constructed via uri.

TryRemoveSourceFileAsync(Uri, Boolean)

Removes the file identified by uri from the list of source files for this compilation unit, publishes empty Diagnostics for that file unless publishEmptyDiagnostics is set to false, and adapts all remaining diagnostics as needed.

TryRemoveSourceFilesAsync(IEnumerable<Uri>, Boolean, Boolean)

Removes files from the list of source files for this compilation unit, publishes empty Diagnostics for the removed files unless publishEmptyDiagnostics is set to false, and adapts all remaining diagnostics as needed.

UpdateReferencesAsync(References)

Replaces the content from all referenced assemblies with references, and updates all diagnostics accordingly.

Applies to