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 }