Langium - v4.0.0
    Preparing search index...

    Interface DocumentBuilder

    Shared-service for building and updating LangiumDocuments.

    interface DocumentBuilder {
        updateBuildOptions: BuildOptions;
        build<T extends AstNode>(
            documents: LangiumDocument<T>[],
            options?: BuildOptions,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<void>;
        onBuildPhase(
            targetState: DocumentState,
            callback: DocumentBuildListener,
        ): Disposable;
        onDocumentPhase(
            targetState: DocumentState,
            callback: DocumentPhaseListener,
        ): Disposable;
        onUpdate(callback: DocumentUpdateListener): Disposable;
        resetToState<T extends AstNode>(
            document: LangiumDocument<T>,
            state: DocumentState,
        ): void;
        update(
            changed: URI[],
            deleted: URI[],
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<void>;
        waitUntil(
            state: DocumentState,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<void>;
        waitUntil(
            state: DocumentState,
            uri?: URI,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<undefined | URI>;
    }

    Implemented by

    Index

    Properties

    updateBuildOptions: BuildOptions

    The options used for rebuilding documents after an update.

    Methods

    • 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

      • OptionalcancelToken: Cancellation.CancellationToken

        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: Cancellation.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 document specified by the uri has reached the specified state.

      Parameters

      • state: DocumentState

        The desired state. The promise won't resolve until the document has reached this state.

      • Optionaluri: URI

        The specified URI that points to the document. If the URI does not exist, the promise will resolve once the workspace has reached the specified state.

      • OptionalcancelToken: Cancellation.CancellationToken

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

      Returns Promise<undefined | URI>

      The URI of the document that has reached the desired state, or undefined if the document does not exist.

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