mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-24 01:24:18 +08:00
fix: use global config endpoint for settings persistence
The extension was using PATCH /config (instance-scoped) which writes to <project>/config.json — a file the config loader never reads back on restart. The desktop app uses PATCH /global/config which correctly writes to the global config file (~/.config/opencode/opencode.json). Changed updateConfig to hit /global/config (matching the desktop app) and removed the now-unnecessary directory parameter.
This commit is contained in:
@@ -663,7 +663,8 @@ export class KiloProvider implements vscode.WebviewViewProvider {
|
||||
|
||||
/**
|
||||
* Handle config update request from the webview.
|
||||
* Applies a partial config update, then re-fetches and pushes the full config.
|
||||
* Applies a partial config update via the global config endpoint, then pushes
|
||||
* the full merged config back to the webview.
|
||||
*/
|
||||
private async handleUpdateConfig(partial: Record<string, unknown>): Promise<void> {
|
||||
if (!this.httpClient) {
|
||||
@@ -672,8 +673,7 @@ export class KiloProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
|
||||
try {
|
||||
const workspaceDir = this.getWorkspaceDirectory()
|
||||
const updated = await this.httpClient.updateConfig(partial, workspaceDir)
|
||||
const updated = await this.httpClient.updateConfig(partial)
|
||||
|
||||
const message = {
|
||||
type: "configUpdated",
|
||||
|
||||
@@ -188,10 +188,12 @@ export class HttpClient {
|
||||
|
||||
/**
|
||||
* Update backend configuration (partial merge).
|
||||
* The server merges the provided fields into the existing config.
|
||||
* Uses the global config endpoint so changes persist to the user's global
|
||||
* config file (matching the desktop app behaviour). The instance-scoped
|
||||
* PATCH /config writes to a project-local file that is not loaded on restart.
|
||||
*/
|
||||
async updateConfig(config: Partial<Config>, directory: string): Promise<Config> {
|
||||
return this.request<Config>("PATCH", "/config", config, { directory })
|
||||
async updateConfig(config: Partial<Config>): Promise<Config> {
|
||||
return this.request<Config>("PATCH", "/global/config", config)
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user