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

Function applyEditorChoice

apps/kimi-code/src/tui/commands/config.ts:331–358  ·  view source on GitHub ↗
(host: SlashCommandHost, value: string)

Source from the content-addressed store, hash-verified

329}
330
331async function applyEditorChoice(host: SlashCommandHost, value: string): Promise<void> {
332 const previous = host.state.appState.editorCommand ?? '';
333 if (value === previous && value.length > 0) {
334 host.showStatus(`Editor unchanged: ${value.length > 0 ? value : 'auto-detect'}`);
335 return;
336 }
337
338 const editorCommand = value.length > 0 ? value : null;
339 try {
340 await saveTuiConfig({
341 ...currentTuiConfig(host),
342 editorCommand,
343 });
344 } catch (error) {
345 host.showStatus(
346 `Failed to save editor: ${formatErrorMessage(error)}`,
347 'error',
348 );
349 return;
350 }
351
352 host.setAppState({ editorCommand });
353 host.showStatus(
354 value.length > 0
355 ? `Editor set to "${value}".`
356 : 'Editor set to auto-detect ($VISUAL / $EDITOR).',
357 );
358}
359
360export function showModelPicker(host: SlashCommandHost, selectedValue: string = host.state.appState.model): void {
361 const entries = Object.entries(host.state.appState.availableModels);

Callers 2

handleEditorCommandFunction · 0.85
showEditorPickerFunction · 0.85

Calls 5

saveTuiConfigFunction · 0.90
formatErrorMessageFunction · 0.90
currentTuiConfigFunction · 0.85
showStatusMethod · 0.65
setAppStateMethod · 0.65

Tested by

no test coverage detected