From e0f4c128da4baf43e04c2c2bf60ffa18461d2027 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 19 Apr 2024 14:47:17 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20global=20filewatcher=20for=20config?= =?UTF-8?q?.json/ts=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/static/schemas/config.json | 7 +++++-- .../src/main/resources/config_schema.json | 7 +++++-- extensions/vscode/continue_rc_schema.json | 7 +++++-- .../vscode/src/extension/vscodeExtension.ts | 21 ++++++++++++------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 05be94570..47f1df213 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1823,8 +1823,11 @@ "description": "Defaults to true. If set to false, Continue will not attempt to include snippets from other files." }, "disableInFiles": { - "type": "boolean", - "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files." + "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files.", + "type": "array", + "items": { + "type": "string" + } } }, "required": [] diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 05be94570..47f1df213 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1823,8 +1823,11 @@ "description": "Defaults to true. If set to false, Continue will not attempt to include snippets from other files." }, "disableInFiles": { - "type": "boolean", - "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files." + "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files.", + "type": "array", + "items": { + "type": "string" + } } }, "required": [] diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 0ec5b1bf8..737e09ead 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -2057,8 +2057,11 @@ "description": "Defaults to true. If set to false, Continue will not attempt to include snippets from other files." }, "disableInFiles": { - "type": "boolean", - "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files." + "description": "A list of files / glob patterns in which to disable tab autocomplete. For example, *.csv if you'd like to disable autocomplete in .csv files.", + "type": "array", + "items": { + "type": "string" + } } }, "required": [] diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index 5f1cc1ea8..84cf58869 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -1,6 +1,8 @@ import { ConfigHandler } from "core/config/handler"; import { CodebaseIndexer, PauseToken } from "core/indexing/indexCodebase"; import { IdeSettings } from "core/protocol"; +import { getConfigJsonPath, getConfigTsPath } from "core/util/paths"; +import fs from "fs"; import { v4 as uuidv4 } from "uuid"; import * as vscode from "vscode"; import { ContinueCompletionProvider } from "../autocomplete/completionProvider"; @@ -189,17 +191,20 @@ export class VsCodeExtension { // Indexing this.ide.getWorkspaceDirs().then((dirs) => this.refreshCodebaseIndex(dirs)); - // Listen for file saving + // Listen for file saving - use global file watcher so that changes + // from outside the window are also caught + fs.watchFile(getConfigJsonPath(), { interval: 1000 }, (stats) => { + this.configHandler.reloadConfig(); + }); + fs.watchFile(getConfigTsPath(), { interval: 1000 }, (stats) => { + this.configHandler.reloadConfig(); + }); + vscode.workspace.onDidSaveTextDocument((event) => { + // Listen for file changes in the workspace const filepath = event.uri.fsPath; - if ( - filepath.endsWith(".continue/config.json") || - filepath.endsWith(".continue\\config.json") || - filepath.endsWith(".continue/config.ts") || - filepath.endsWith(".continue\\config.ts") || - filepath.endsWith(".continuerc.json") - ) { + if (filepath.endsWith(".continuerc.json")) { this.configHandler.reloadConfig(); this.tabAutocompleteModel.clearLlm(); } else if (