MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / setupAutocomplete

Method setupAutocomplete

apps/kimi-code/src/tui/kimi-tui.ts:376–407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

374 }
375
376 private setupAutocomplete(): void {
377 const slashCommands: SlashAutocompleteCommand[] = this.getSlashCommands().map((cmd) => {
378 const completer = cmd.completeArgs;
379 return {
380 name: cmd.name,
381 aliases: cmd.aliases,
382 description: cmd.description,
383 ...(cmd.argumentHint !== undefined ? { argumentHint: cmd.argumentHint } : {}),
384 ...(completer !== undefined
385 ? { getArgumentCompletions: (prefix: string) => completer(prefix) }
386 : {}),
387 };
388 });
389 const provider = new FileMentionProvider(
390 slashCommands,
391 this.state.appState.workDir,
392 this.fdPath,
393 this.state.appState.additionalDirs,
394 () => this.state.appState.inputMode,
395 );
396 this.state.editor.setAutocompleteProvider(provider);
397
398 const argumentHints = new Map<string, string>();
399 for (const cmd of slashCommands) {
400 if (cmd.argumentHint === undefined) continue;
401 argumentHints.set(cmd.name, cmd.argumentHint);
402 for (const alias of cmd.aliases ?? []) {
403 argumentHints.set(alias, cmd.argumentHint);
404 }
405 }
406 this.state.editor.setArgumentHints(argumentHints);
407 }
408
409 refreshSlashCommandAutocomplete(): void {
410 this.setupAutocomplete();

Callers 6

refreshSkillCommandsMethod · 0.95
refreshPluginCommandsMethod · 0.95
initMainTuiMethod · 0.95
setAppStateMethod · 0.95

Calls 4

getSlashCommandsMethod · 0.95
setArgumentHintsMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected