import { Connection, Diagnostic, ClientCapabilities, WorkspaceFolder, WorkspaceFoldersChangeEvent, DidChangeWatchedFilesParams } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { Node } from 'yaml'; import { IPluginRoute } from './interfaces/pluginRouting.cjs'; import { IModuleMetadata } from './interfaces/module.cjs'; import { IContainerEngine, IVolumeMounts } from './interfaces/extensionSettings.cjs'; import { MetadataLibrary } from './services/metadataLibrary.cjs'; import { SettingsManager } from './services/settingsManager.cjs'; interface ansibleMetaDataEntryType { [name: string]: { [name: string]: string | string[] | undefined | object[]; } | string | string[] | object[] | undefined; } interface ansibleMetaDataType { "ansible information"?: ansibleMetaDataEntryType; "python information"?: ansibleMetaDataEntryType; "ansible-lint information"?: ansibleMetaDataEntryType; "execution environment information"?: ansibleMetaDataEntryType | undefined; } declare function getAnsibleMetaData(contextLocal: WorkspaceFolderContext, connectionLocal: Connection | undefined): Promise; declare function getResultsThroughCommandRunner(cmd: string, arg: string): Promise<{ stdout: string; stderr: string; } | undefined>; declare class AnsibleConfig { private connection; private context; private _collection_paths; private _module_locations; private _ansible_location; private _default_host_list; private _ansible_meta_data; constructor(connection: Connection, context: WorkspaceFolderContext); initialize(): Promise; set collections_paths(updatedCollectionPath: string[]); get collections_paths(): string[]; set default_host_list(defaultHostList: string[]); get default_host_list(): string[]; set module_locations(updatedModulesPath: string[]); get module_locations(): string[]; get ansible_location(): string; get ansible_meta_data(): ansibleMetaDataType; } /** * Acts as and interface to ansible-lint and a cache of its output. * * ansible-lint may provide diagnostics for more than just the file for which * linting was triggered, and this is reflected in the implementation. */ declare class AnsibleLint { private connection; private context; private useProgressTracker; private _ansibleLintConfigFilePath; constructor(connection: Connection, context: WorkspaceFolderContext); /** * Perform linting for the given document. * * In case no errors are found for the current document, and linting has been * performed on opening the document, then only the cache is cleared, and not * the diagnostics on the client side. That way old diagnostics will persist * until the file is changed. This allows inspecting more complex errors * reported in other files. */ doValidate(textDocument: TextDocument): Promise>; private processReport; private findAnsibleLintConfigFile; get ansibleLintConfigFilePath(): string | undefined; } /** * Acts as an interface to ansible-playbook command. */ declare class AnsiblePlaybook { private connection; private context; private useProgressTracker; /** * * @param connection - establishes connection with the client * @param context - provides workspace context of the client */ constructor(connection: Connection, context: WorkspaceFolderContext); /** * Acts as an interface to ansible-playbook --syntax-check command and a cache of its output. * ansible syntax-check may provide diagnostics for more than just the file for which * it was triggered, and this is reflected in the implementation. * * Perform ansible syntax-check for the given document. */ doValidate(textDocument: TextDocument): Promise>; private processReport; } declare class DocsLibrary { private connection; private modules; private _moduleFqcns; private docFragments; private context; private pluginRouting; constructor(connection: Connection, context: WorkspaceFolderContext); initialize(): Promise; /** * Tries to find an Ansible module for a given name or FQCN. * * Parameters `contextPath` and `documentUri` are used to obtain contextual * information on declared collections. Hence these are not needed when * searching with FQCN. * * Returns the module if found and an FQCN for which either a module or a * route has been found. */ findModule(searchText: string, contextPath?: Node[], documentUri?: string): Promise<[IModuleMetadata | undefined, string | undefined]>; private findDocumentationInModulesPath; private findDocumentationInCollectionsPath; private getCandidateFqcns; getModuleRoute(fqcn: string): IPluginRoute | undefined; getModuleFqcns(documentUri: string): Promise>; } declare class ExecutionEnvironment { isServiceInitialized: boolean; private settings; private connection; private context; private useProgressTracker; private successFileMarker; private settingsVolumeMounts; private settingsContainerOptions; private _container_engine; private _container_image; private _container_image_id; private _container_volume_mounts; constructor(connection: Connection, context: WorkspaceFolderContext); initialize(): Promise; fetchPluginDocs(ansibleConfig: AnsibleConfig): Promise; wrapContainerArgs(command: string, mountPaths?: Set): string[] | undefined; private pullContainerImage; private isExecutableAvailable; private setContainerEngine; private cleanUpContainer; private doesContainerNameExist; private updateContainerVolumeMountFromSettings; private isPluginInPath; private runContainer; private copyPluginDocFiles; private updateCachePaths; private isPluginDocCacheValid; get getBasicContainerAndImageDetails(): { containerEngine: IContainerEngine | undefined; containerImage: string | undefined; containerImageId: string | undefined; containerVolumeMounts: IVolumeMounts[] | undefined; }; } type HostType = { host: string; priority: number; }; /** * Class to extend ansible-inventory executable as a service */ declare class AnsibleInventory { private connection; private context; private _hostList; constructor(connection: Connection, context: WorkspaceFolderContext); initialize(): Promise; get hostList(): HostType[]; } /** * Holds the overall context for the whole workspace. */ declare class WorkspaceManager { connection: Connection; private sortedWorkspaceFolders; private folderContexts; clientCapabilities: ClientCapabilities; constructor(connection: Connection); setWorkspaceFolders(workspaceFolders: WorkspaceFolder[]): void; setCapabilities(capabilities: ClientCapabilities): void; /** * Determines the workspace folder context for the given URI. */ getContext(uri: string): WorkspaceFolderContext | undefined; forEachContext(callbackfn: (value: WorkspaceFolderContext) => Promise | void): Promise; /** * Finds the inner-most workspace folder for the given URI. */ getWorkspaceFolder(uri: string): WorkspaceFolder | undefined; handleWorkspaceChanged(event: WorkspaceFoldersChangeEvent): void; private sortWorkspaceFolders; } /** * Holds the context for particular workspace folder. This context is used by * all services to interact with the client and with each other. */ declare class WorkspaceFolderContext { private connection; clientCapabilities: ClientCapabilities; workspaceFolder: WorkspaceFolder; documentMetadata: MetadataLibrary; documentSettings: SettingsManager; private _executionEnvironment; private _docsLibrary; private _ansibleConfig; private _ansibleInventory; private _ansibleLint; private _ansiblePlaybook; private _configChangeTimer; constructor(connection: Connection, workspaceFolder: WorkspaceFolder, workspaceManager: WorkspaceManager); handleWatchedDocumentChange(params: DidChangeWatchedFilesParams): void; get docsLibrary(): Thenable; get ansibleConfig(): Thenable; get ansibleInventory(): Thenable; clearAnsibleInventory(): void; clearCachedServices(): void; get ansibleLint(): AnsibleLint; get ansiblePlaybook(): AnsiblePlaybook; get executionEnvironment(): Thenable; } export { AnsibleConfig as A, DocsLibrary as D, ExecutionEnvironment as E, type HostType as H, WorkspaceFolderContext as W, AnsibleInventory as a, AnsibleLint as b, AnsiblePlaybook as c, WorkspaceManager as d, type ansibleMetaDataEntryType as e, type ansibleMetaDataType as f, getAnsibleMetaData as g, getResultsThroughCommandRunner as h };