import { TextDocument } from 'vscode-languageserver-textdocument'; import { Node, Pair, Schema, YAMLMap, Document, ParseOptions, DocumentOptions, SchemaOptions } from 'yaml'; import { IModuleMetadata, IOption } from '../interfaces/module.cjs'; import { D as DocsLibrary } from '../workspaceManager-C3bX4Twa.cjs'; import { Position } from 'vscode-languageserver'; import '../interfaces/pluginRouting.cjs'; import '../interfaces/extensionSettings.cjs'; import '../services/metadataLibrary.cjs'; import 'vscode-languageserver-protocol'; import '../interfaces/documentMeta.cjs'; import '../services/settingsManager.cjs'; type Options = ParseOptions & DocumentOptions & SchemaOptions; /** * A helper class used for building YAML path assertions and retrieving parent * nodes. The assertions are built up from the most nested (last in array) * element. */ declare class AncestryBuilder { private _path; private _index; constructor(path: Node[] | null, index?: number); /** * Move up the path, optionally asserting the type of the parent. * * Unless Pair is explicitly asserted, it is ignored/skipped over when moving * up. */ parent(type?: new (...args: Schema[]) => X): AncestryBuilder; /** * Move up the path, asserting that the current node was a key of a mapping * pair. The builder skips over the Pair to the parent YAMLMap. */ parentOfKey(): AncestryBuilder; /** * Get node up to which the assertions have led. */ get(): N | null; /** * Get the key of the Pair one level down the path. * * The key is returned only if it indeed is a string Scalar. */ getStringKey(this: AncestryBuilder): string | null; /** * Get the value of the Pair one level down the path. */ getValue(this: AncestryBuilder): Node | null; /** * Get the path to which the assertions have led. * * The path will be a subpath of the original path. */ getPath(): Node[] | null; /** * Get the path to the key of the Pair one level down the path to which the * assertions have led. * * The path will be a subpath of the original path. */ getKeyPath(this: AncestryBuilder): Node[] | null; } declare function getPathAt(document: TextDocument, position: Position, docs: Document[], inclusive?: boolean): Node[] | null; /** * Determines whether the path points at a parameter key of an Ansible task. */ declare function isTaskParam(path: Node[]): boolean; /** * Tries to find the list of collections declared at the Ansible play/block/task level. */ declare function getDeclaredCollections(modulePath: Node[] | null): string[]; /** * Heuristically determines whether the path points at an Ansible play. The * `fileUri` helps guessing in case the YAML tree doesn't give any clues. * * Returns `undefined` if highly uncertain. */ declare function isPlayParam(path: Node[], fileUri?: string): boolean | undefined; /** * Determines whether the path points at one of Ansible block parameter keys. */ declare function isBlockParam(path: Node[]): boolean; /** * Determines whether the path points at one of Ansible role parameter keys. */ declare function isRoleParam(path: Node[]): boolean; /** * If the path points at a parameter or sub-parameter provided for a module, it * will return the list of all possible options or sub-options at that * level/indentation. */ declare function getPossibleOptionsForPath(path: Node[], document: TextDocument, docsLibrary: DocsLibrary): Promise | null>; /** * For a given Ansible task parameter path, find the module if it has been * provided for the task. */ declare function findProvidedModule(taskParamPath: Node[], document: TextDocument, docsLibrary: DocsLibrary): Promise; declare function getYamlMapKeys(mapNode: YAMLMap): Array; declare function getOrigRange(node: Node | null | undefined): [number, number] | undefined; /** Parsing with the YAML library tailored to the needs of this extension */ declare function parseAllDocuments(str: string, options?: Options): Document[]; /** * For a given yaml file that is recognized as Ansible file, the function * checks whether the file is a playbook or not * @param textDocument - the text document to check */ declare function isPlaybook(textDocument: TextDocument): boolean; /** * A function to check if the cursor is present inside valid jinja inline brackets in a yaml file * @param document - text document on which the function is to be checked * @param position - current cursor position * @param path - array of nodes leading to that position * @returns boolean true if the cursor is inside valid jinja inline brackets, else false */ declare function isCursorInsideJinjaBrackets(document: TextDocument, position: Position, path: Node[]): boolean; export { AncestryBuilder, findProvidedModule, getDeclaredCollections, getOrigRange, getPathAt, getPossibleOptionsForPath, getYamlMapKeys, isBlockParam, isCursorInsideJinjaBrackets, isPlayParam, isPlaybook, isRoleParam, isTaskParam, parseAllDocuments };