Interface IndexManager

The index manager is responsible for keeping metadata about symbols and cross-references in the workspace. It is used to look up symbols in the global scope, mostly during linking and completion. This service is shared between all languages of a language server.

interface IndexManager {
    allElements(nodeType?: string, uris?: Set<string>): Stream<AstNodeDescription>;
    findAllReferences(targetNode: AstNode, astNodePath: string): Stream<ReferenceDescription>;
    isAffected(document: LangiumDocument<AstNode>, changedUris: Set<string>): boolean;
    remove(uri: URI): void;
    updateContent(document: LangiumDocument<AstNode>, cancelToken?: CancellationToken): Promise<void>;
    updateReferences(document: LangiumDocument<AstNode>, cancelToken?: CancellationToken): Promise<void>;
}

Implemented by

Methods

  • Compute a list of all exported elements, optionally filtered using a type identifier and document URIs.

    Parameters

    • OptionalnodeType: string

      The type to filter with, or undefined to return descriptions of all types.

    • Optionaluris: Set<string>

      If specified, only returns elements from the given URIs.

    Returns Stream<AstNodeDescription>

    a Stream containing all globally visible nodes (of a given type).

  • Determine whether the given document could be affected by changes of the documents identified by the given URIs (second parameter). The document is typically regarded as affected if it contains a reference to any of the changed files.

    Parameters

    • document: LangiumDocument<AstNode>

      Document to check whether it's affected

    • changedUris: Set<string>

      URIs of the changed documents

    Returns boolean

  • Removes the specified document URI from the index. Necessary when documents are deleted and not referenceable anymore.

    Parameters

    • uri: URI

      The URI of the document for which index data shall be removed

    Returns void