Langium - v4.0.0
    Preparing search index...

    Interface ScopeComputation

    Language-specific service for precomputing global and local scopes. The service methods are executed as the first and second phase in the DocumentBuilder.

    interface ScopeComputation {
        collectExportedSymbols(
            document: LangiumDocument,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<AstNodeDescription[]>;
        collectLocalSymbols(
            document: LangiumDocument,
            cancelToken?: Cancellation.CancellationToken,
        ): Promise<LocalSymbols>;
    }

    Implemented by

    Index

    Methods

    • Creates descriptions of all AST nodes that shall be exported into the global scope from the given document. These descriptions are gathered by the IndexManager and stored in the global index so they can be referenced from other documents.

      Note: You should not resolve any cross-references in this service method. Cross-reference resolution depends on the scope computation phase to be completed (computeScope method), which runs after the initial indexing where this method is used.

      Parameters

      Returns Promise<AstNodeDescription[]>

      OperationCanceled if a user action occurs during execution

    • Creates descriptions of the local symbols being accessible within a document. The result is a LocalSymbols table assigning sets of AST node descriptions to the corresponding nodes/subtrees within the AST. The descriptions are considered in the default reference resolution implementation, i.e. they are used by the ScopeProvider service to determine which symbols are visible in the context of a specific cross-reference.

      Note: You should not resolve any cross-references in this service method. Cross-reference resolution depends on the scope computation phase to be completed.

      Parameters

      Returns Promise<LocalSymbols>

      OperationCanceled if a user action occurs during execution