Class DefaultLinker

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

Implements

Constructors

Properties

astNodeLocator: AstNodeLocator
langiumDocuments: (() => LangiumDocuments)
reflection: AstReflection
scopeProvider: ScopeProvider

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<AstNode>

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

  • Links all cross-references within the specified document. The default implementation loads only target elements from documents that are present in the LangiumDocuments service. The linked references are stored in the document's references property.

    Parameters

    Returns Promise<void>

    OperationCancelled if a cancellation event is detected