/*! license ISC * @author Bombshell team and Bombshell contributors * Bombshell related codes are forked from @bombsh/tab */ import { Completion } from "@bomb.sh/tab"; import { PluginWithoutExtension } from "@gunshi/plugin"; //#region ../shared/src/constants.d.ts /** * @author kazuya kawaguchi (a.k.a. kazupon) * @license MIT */ /** * @author kazuya kawaguchi (a.k.a. kazupon) * @license MIT */ declare const BUILT_IN_PREFIX = "_"; declare const PLUGIN_PREFIX = "g"; declare const BUILT_IN_KEY_SEPARATOR = ":"; //#endregion //#region ../plugin-i18n/src/types.d.ts //#endregion //#region ../plugin-i18n/src/helpers.d.ts //#endregion //#region ../plugin-i18n/src/translation.d.ts //#endregion //#region ../gunshi/src/index.d.ts //#endregion //#region ../shared/src/types.d.ts /** * Generate a namespaced key. */ type GenerateNamespacedKey = `${Prefixed}${typeof BUILT_IN_KEY_SEPARATOR}${Key}`; //#endregion //#region ../shared/src/localization.d.ts //#endregion //#region ../shared/src/utils.d.ts //#endregion //#region ../shared/src/index.d.ts //#endregion //#region src/types.d.ts /** * The unique identifier for the completion plugin. */ declare const pluginId: GenerateNamespacedKey<'completion', typeof PLUGIN_PREFIX>; /** * Type representing the unique identifier for the completion plugin. */ type PluginId = typeof pluginId; /** * Parameters for {@linkcode CompletionHandler | the completion handler}. */ interface CompletionParams { /** * The locale to use for i18n. */ locale?: Intl.Locale; } /** * The handler for completion. * * @param params - The {@linkcode CompletionParams | parameters} for the completion handler. * @returns An array of {@linkcode Completion | completions}. */ type CompletionHandler = (params: CompletionParams) => Completion[]; /** * Extended command context which provides utilities via completion plugin. * These utilities are available via `CommandContext.extensions['g:completion']`. */ interface CompletionExtension {} /** * Completion configuration, which structure is similar `bombsh/tab`'s `CompletionConfig`. */ interface CompletionConfig { /** * The {@linkcode CompletionHandler | handler} for the completion. */ handler?: CompletionHandler; /** * The command arguments for the completion. */ args?: Record; } /** * Completion plugin options. */ interface CompletionOptions { /** * The completion configuration */ config?: { /** * The entry point {@linkcode CompletionConfig | completion configuration}. */ entry?: CompletionConfig; /** * The handlers for sub-commands. */ subCommands?: Record; }; } //#endregion //#region src/index.d.ts /** * completion plugin * * @param options - A {@linkcode CompletionOptions | Completion options} * @returns A defined plugin as completion */ declare function completion(options?: CompletionOptions): PluginWithoutExtension; //#endregion export { CompletionConfig, CompletionExtension, CompletionHandler, CompletionOptions, CompletionParams, PluginId, completion as default, pluginId };