mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 02:01:29 +00:00
feat(coding-agent): extension command argument autocomplete
This commit is contained in:
parent
f900eb591d
commit
35e48ca018
5 changed files with 25 additions and 2 deletions
|
|
@ -150,7 +150,7 @@ function createExtensionAPI(
|
|||
});
|
||||
},
|
||||
|
||||
registerCommand(name: string, options: { description?: string; handler: RegisteredCommand["handler"] }): void {
|
||||
registerCommand(name: string, options: Omit<RegisteredCommand, "name">): void {
|
||||
extension.commands.set(name, { name, ...options });
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import type {
|
|||
} from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent, Model, TextContent, ToolResultMessage } from "@mariozechner/pi-ai";
|
||||
import type {
|
||||
AutocompleteItem,
|
||||
Component,
|
||||
EditorComponent,
|
||||
EditorTheme,
|
||||
|
|
@ -655,6 +656,7 @@ export type MessageRenderer<T = unknown> = (
|
|||
export interface RegisteredCommand {
|
||||
name: string;
|
||||
description?: string;
|
||||
getArgumentCompletions?: (argumentPrefix: string) => AutocompleteItem[] | null;
|
||||
handler: (args: string, ctx: ExtensionCommandContext) => Promise<void>;
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +716,7 @@ export interface ExtensionAPI {
|
|||
// =========================================================================
|
||||
|
||||
/** Register a custom command. */
|
||||
registerCommand(name: string, options: { description?: string; handler: RegisteredCommand["handler"] }): void;
|
||||
registerCommand(name: string, options: Omit<RegisteredCommand, "name">): void;
|
||||
|
||||
/** Register a keyboard shortcut. */
|
||||
registerShortcut(
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ export class InteractiveMode {
|
|||
(cmd) => ({
|
||||
name: cmd.name,
|
||||
description: cmd.description ?? "(extension command)",
|
||||
getArgumentCompletions: cmd.getArgumentCompletions,
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue