From 88918f4c2fcb5552700e0fbe0b565689ca85a101 Mon Sep 17 00:00:00 2001 From: Mark IJbema Date: Mon, 16 Feb 2026 14:25:16 +0100 Subject: [PATCH] fix: gate chat textarea autocomplete on enableChatAutocomplete setting PromptInput.tsx always requested chat completions regardless of the enableChatAutocomplete setting value. Now it listens for the autocompleteSettingsLoaded message, requests the settings on init, and checks chatAutocompleteEnabled() before firing requestAutocomplete(). --- .../webview-ui/src/components/chat/PromptInput.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx b/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx index 7b1e4f9dcb..6cd82a1664 100644 --- a/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx @@ -24,6 +24,7 @@ export const PromptInput: Component = () => { const [text, setText] = createSignal("") const [ghostText, setGhostText] = createSignal("") + const [chatAutocompleteEnabled, setChatAutocompleteEnabled] = createSignal(false) let textareaRef: HTMLTextAreaElement | undefined let debounceTimer: ReturnType | undefined let requestCounter = 0 @@ -32,7 +33,7 @@ export const PromptInput: Component = () => { const isDisabled = () => !server.isConnected() const canSend = () => text().trim().length > 0 && !isBusy() && !isDisabled() - // Listen for chat completion results from the extension + // Listen for chat completion results and autocomplete settings from the extension const unsubscribe = vscode.onMessage((message) => { if (message.type === "chatCompletionResult") { const result = message as { type: "chatCompletionResult"; text: string; requestId: string } @@ -42,8 +43,17 @@ export const PromptInput: Component = () => { setGhostText(result.text) } } + if (message.type === "autocompleteSettingsLoaded") { + const settings = ( + message as { type: "autocompleteSettingsLoaded"; settings: { enableChatAutocomplete: boolean } } + ).settings + setChatAutocompleteEnabled(settings.enableChatAutocomplete) + } }) + // Request autocomplete settings so we know whether chat autocomplete is enabled + vscode.postMessage({ type: "requestAutocompleteSettings" }) + onCleanup(() => { unsubscribe() if (debounceTimer) { @@ -53,7 +63,7 @@ export const PromptInput: Component = () => { // Request autocomplete from the extension const requestAutocomplete = (currentText: string) => { - if (currentText.length < MIN_TEXT_LENGTH || isDisabled()) { + if (!chatAutocompleteEnabled() || currentText.length < MIN_TEXT_LENGTH || isDisabled()) { setGhostText("") return }