MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / getDocument

Function getDocument

packages/language/src/utils.ts:704–711  ·  view source on GitHub ↗
(node: AstNode)

Source from the content-addressed store, hash-verified

702 * @throws an error if the node is not contained in a document.
703 */
704export function getDocument<T extends AstNode = AstNode>(node: AstNode): LangiumDocument<T> {
705 const rootNode = findRootNode(node);
706 const result = rootNode.$document;
707 if (!result) {
708 throw new Error('AST node has no document.');
709 }
710 return result as LangiumDocument<T>;
711}
712
713/**
714 * Gets the list of plugin documents from the given model.

Callers 3

loadImportsFunction · 0.90
eagerLoadAllImportsFunction · 0.90

Calls 1

findRootNodeFunction · 0.85

Tested by

no test coverage detected