Langium - v4.0.0
    Preparing search index...

    Interface Linker

    Language-specific service for resolving cross-references in the AST.

    interface Linker {
        buildMultiReference(
            node: AstNode,
            property: string,
            refNode: undefined | CstNode,
            refText: string,
        ): MultiReference;
        buildReference(
            node: AstNode,
            property: string,
            refNode: undefined | CstNode,
            refText: string,
        ): Reference;
        getCandidate(refInfo: ReferenceInfo): LinkingError | AstNodeDescription;
        getCandidates(refInfo: ReferenceInfo): LinkingError | AstNodeDescription[];
        link(
            document: LangiumDocument,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<void>;
        unlink(document: LangiumDocument): void;
    }

    Implemented by

    Index

    Methods

    • Creates a cross reference node being aware of its containing AstNode, the corresponding CstNode, the cross reference text denoting the target AstNode being already extracted of the document text, as well as the unique cross reference identifier.

      Default behavior:

      • The returned Reference's 'ref' property pointing to the target AstNode is populated lazily on its first visit.
      • If the target AstNode cannot be resolved on the first visit, an error indicator will be installed and further resolution attempts will not be performed.

      Parameters

      • node: AstNode

        The containing AST node

      • property: string

        The AST node property being referenced

      • refNode: undefined | CstNode

        The corresponding CST node

      • refText: string

        The cross reference text denoting the target AstNode

      Returns Reference

      the desired Reference node, whose behavior wrt. resolving the cross reference is implementation specific.