Class DefaultDocumentBuilder

Shared-service for building and updating LangiumDocuments.

Implements

Constructors

Properties

buildPhaseListeners: MultiMap<DocumentState, DocumentBuildListener> = ...
buildState: Map<string, DocumentBuildState> = ...
currentState: DocumentState = DocumentState.Changed
documentBuildWaiters: Map<string, Deferred<void>> = ...
documentPhaseListeners: MultiMap<DocumentState, DocumentPhaseListener> = ...
indexManager: IndexManager
langiumDocumentFactory: LangiumDocumentFactory
langiumDocuments: LangiumDocuments
serviceRegistry: ServiceRegistry
textDocuments: undefined | TextDocumentProvider
updateBuildOptions: BuildOptions = ...

The options used for rebuilding documents after an update.

updateListeners: DocumentUpdateListener[] = []

Methods

  • Determine whether the given document should be linked during a build. The default implementation checks the eagerLinking property of the build options. If it's set to true or undefined, the document is included in the linking phase. This also affects the references indexing phase, which depends on eager linking.

    Parameters

    Returns boolean

  • Determine whether the given document should be validated during a build. The default implementation checks the validation property of the build options. If it's set to true or a ValidationOptions object, the document is included in the validation phase.

    Parameters

    Returns boolean

  • This method is called when a document change is detected. It updates the state of all affected documents, including those with references to the changed ones, so they are rebuilt.

    Parameters

    • changed: URI[]

      URIs of changed or created documents

    • deleted: URI[]

      URIs of deleted documents

    • cancelToken: CancellationToken = CancellationToken.None

      allows to cancel the current operation

    Returns Promise<void>

    OperationCancelled if cancellation is detected during execution

  • Wait until the workspace has reached the specified state for all documents.

    Parameters

    • state: DocumentState

      The desired state. The promise won't resolve until all documents have reached this state

    • OptionalcancelToken: CancellationToken

      Optionally allows to cancel the wait operation, disposing any listeners in the process

    Returns Promise<void>

    OperationCancelled if cancellation has been requested before the state has been reached

  • Wait until the workspace has reached the specified state for all documents.

    Parameters

    • state: DocumentState

      The desired state. The promise won't resolve until all documents have reached this state

    • Optionaluri: URI
    • OptionalcancelToken: CancellationToken

      Optionally allows to cancel the wait operation, disposing any listeners in the process

    Returns Promise<undefined | URI>

    OperationCancelled if cancellation has been requested before the state has been reached