Interface LangiumDocumentFactory

Shared service for creating LangiumDocument instances.

Register a custom implementation if special (additional) behavior is required for your language(s). Note: If you specialize fromString or fromTextDocument you probably might want to specialize update, too!

interface LangiumDocumentFactory {
    fromModel<T>(model: T, uri: URI): LangiumDocument<T>;
    fromString<T>(text: string, uri: URI, options?: ParserOptions): LangiumDocument<T>;
    fromString<T>(text: string, uri: URI, cancellationToken: CancellationToken): Promise<LangiumDocument<T>>;
    fromTextDocument<T>(textDocument: TextDocument, uri?: URI, options?: ParserOptions): LangiumDocument<T>;
    fromTextDocument<T>(textDocument: TextDocument, uri: undefined | URI, cancellationToken: CancellationToken): Promise<LangiumDocument<T>>;
    fromUri<T>(uri: URI, cancellationToken?: CancellationToken): Promise<LangiumDocument<T>>;
    update<T>(document: LangiumDocument<T>, cancellationToken: CancellationToken): Promise<LangiumDocument<T>>;
}

Implemented by

Methods