From 020f911e5e83e58d7f4533279d805e6df21aa9fc Mon Sep 17 00:00:00 2001 From: Mark IJbema Date: Thu, 12 Feb 2026 14:00:12 +0100 Subject: [PATCH] feat: implement autocomplete settings tab and remove apiKey setting --- packages/kilo-vscode/package.json | 5 -- packages/kilo-vscode/src/KiloProvider.ts | 32 ++++++++ .../components/settings/AutocompleteTab.tsx | 76 +++++++++++++------ .../webview-ui/src/types/messages.ts | 22 ++++++ 4 files changed, 107 insertions(+), 28 deletions(-) diff --git a/packages/kilo-vscode/package.json b/packages/kilo-vscode/package.json index 30d6ce61b73..c658f030b55 100644 --- a/packages/kilo-vscode/package.json +++ b/packages/kilo-vscode/package.json @@ -186,11 +186,6 @@ "type": "boolean", "default": false, "description": "Enable chat textarea autocomplete" - }, - "kilo-code.new.autocomplete.apiKey": { - "type": "string", - "default": "", - "description": "API key for Kilo Gateway autocomplete" } } } diff --git a/packages/kilo-vscode/src/KiloProvider.ts b/packages/kilo-vscode/src/KiloProvider.ts index 9a0da641967..92cd05ec602 100644 --- a/packages/kilo-vscode/src/KiloProvider.ts +++ b/packages/kilo-vscode/src/KiloProvider.ts @@ -208,6 +208,23 @@ export class KiloProvider implements vscode.WebviewViewProvider { .getConfiguration("kilo-code.new") .update("language", message.locale || undefined, vscode.ConfigurationTarget.Global) break + case "requestAutocompleteSettings": + this.sendAutocompleteSettings() + break + case "updateAutocompleteSetting": { + const allowedKeys = new Set([ + "enableAutoTrigger", + "enableSmartInlineTaskKeybinding", + "enableChatAutocomplete", + ]) + if (allowedKeys.has(message.key)) { + await vscode.workspace + .getConfiguration("kilo-code.new.autocomplete") + .update(message.key, message.value, vscode.ConfigurationTarget.Global) + this.sendAutocompleteSettings() + } + break + } case "deleteSession": await this.handleDeleteSession(message.sessionID) break @@ -925,6 +942,21 @@ export class KiloProvider implements vscode.WebviewViewProvider { } } + /** + * Read autocomplete settings from VS Code configuration and push to the webview. + */ + private sendAutocompleteSettings(): void { + const config = vscode.workspace.getConfiguration("kilo-code.new.autocomplete") + this.postMessage({ + type: "autocompleteSettingsLoaded", + settings: { + enableAutoTrigger: config.get("enableAutoTrigger", true), + enableSmartInlineTaskKeybinding: config.get("enableSmartInlineTaskKeybinding", false), + enableChatAutocomplete: config.get("enableChatAutocomplete", false), + }, + }) + } + /** * Post a message to the webview. * Public so toolbar button commands can send messages. diff --git a/packages/kilo-vscode/webview-ui/src/components/settings/AutocompleteTab.tsx b/packages/kilo-vscode/webview-ui/src/components/settings/AutocompleteTab.tsx index 564239d8f13..d74cf9c07fe 100644 --- a/packages/kilo-vscode/webview-ui/src/components/settings/AutocompleteTab.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/settings/AutocompleteTab.tsx @@ -1,30 +1,60 @@ -import { Component } from "solid-js" +import { Component, createSignal, onCleanup } from "solid-js" +import { Switch } from "@kilocode/kilo-ui/switch" +import { useVSCode } from "../../context/vscode" +import type { ExtensionMessage } from "../../types/messages" const AutocompleteTab: Component = () => { + const vscode = useVSCode() + + const [enableAutoTrigger, setEnableAutoTrigger] = createSignal(true) + const [enableSmartInlineTaskKeybinding, setEnableSmartInlineTaskKeybinding] = createSignal(false) + const [enableChatAutocomplete, setEnableChatAutocomplete] = createSignal(false) + + const unsubscribe = vscode.onMessage((message: ExtensionMessage) => { + if (message.type !== "autocompleteSettingsLoaded") { + return + } + setEnableAutoTrigger(message.settings.enableAutoTrigger) + setEnableSmartInlineTaskKeybinding(message.settings.enableSmartInlineTaskKeybinding) + setEnableChatAutocomplete(message.settings.enableChatAutocomplete) + }) + + onCleanup(unsubscribe) + + vscode.postMessage({ type: "requestAutocompleteSettings" }) + + const updateSetting = ( + key: "enableAutoTrigger" | "enableSmartInlineTaskKeybinding" | "enableChatAutocomplete", + value: boolean, + ) => { + vscode.postMessage({ type: "updateAutocompleteSetting", key, value }) + } + return ( -
-
+ updateSetting("enableAutoTrigger", checked)} + description="Automatically show inline completion suggestions as you type" > -

- This section is not implemented yet. It will - contain configuration options and explanatory text related to the selected settings category. During - reimplementation, use this space to validate layout, spacing, scrolling behavior, and navigation state before - wiring up real controls. -

-
+ Enable automatic inline completions + + + updateSetting("enableSmartInlineTaskKeybinding", checked)} + description="Use a smart keybinding for triggering inline tasks" + > + Enable smart inline task keybinding + + + updateSetting("enableChatAutocomplete", checked)} + description="Show autocomplete suggestions in the chat textarea" + > + Enable chat textarea autocomplete +
) } diff --git a/packages/kilo-vscode/webview-ui/src/types/messages.ts b/packages/kilo-vscode/webview-ui/src/types/messages.ts index 234b5617947..11d507af9ac 100644 --- a/packages/kilo-vscode/webview-ui/src/types/messages.ts +++ b/packages/kilo-vscode/webview-ui/src/types/messages.ts @@ -305,6 +305,15 @@ export interface AgentsLoadedMessage { defaultAgent: string } +export interface AutocompleteSettingsLoadedMessage { + type: "autocompleteSettingsLoaded" + settings: { + enableAutoTrigger: boolean + enableSmartInlineTaskKeybinding: boolean + enableChatAutocomplete: boolean + } +} + export type ExtensionMessage = | ReadyMessage | ConnectionStateMessage @@ -327,6 +336,7 @@ export type ExtensionMessage = | DeviceAuthCancelledMessage | ProvidersLoadedMessage | AgentsLoadedMessage + | AutocompleteSettingsLoadedMessage // ============================================ // Messages FROM webview TO extension @@ -426,6 +436,16 @@ export interface RenameSessionRequest { title: string } +export interface RequestAutocompleteSettingsMessage { + type: "requestAutocompleteSettings" +} + +export interface UpdateAutocompleteSettingMessage { + type: "updateAutocompleteSetting" + key: "enableAutoTrigger" | "enableSmartInlineTaskKeybinding" | "enableChatAutocomplete" + value: boolean +} + export type WebviewMessage = | SendMessageRequest | AbortRequest @@ -446,6 +466,8 @@ export type WebviewMessage = | SetLanguageRequest | DeleteSessionRequest | RenameSessionRequest + | RequestAutocompleteSettingsMessage + | UpdateAutocompleteSettingMessage // ============================================ // VS Code API type