From 38d1e297a51647e01e170dae7842c6ec7e75df9d Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 16 Jan 2025 16:52:23 +0100 Subject: [PATCH 1/2] chore(hidden features): add defaults to initail state. --- src/sidebar.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sidebar.ts b/src/sidebar.ts index cb4b3cde..c57e71ca 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -874,6 +874,9 @@ export class PanelWebview implements vscode.WebviewViewProvider { features: { vecdb, ast, + images: true, + statistics: true, + knowledge: false, }, keyBindings: { completeManual, From d3231372b0ded6500bae8dc64b0df35a3bf2c26e Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Fri, 24 Jan 2025 14:08:09 +0100 Subject: [PATCH 2/2] feat(knowledge): add workspace to initial state and event handler for changing workspace. --- src/sidebar.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sidebar.ts b/src/sidebar.ts index c57e71ca..7c30a289 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -34,6 +34,7 @@ import { ideChatPageChange, ideEscapeKeyPressed, ideIsChatStreaming, + setCurrentProjectInfo } from "refact-chat-js/dist/events"; import { basename, join } from "path"; import { diff_paste_back } from "./chatTab"; @@ -119,6 +120,10 @@ export class PanelWebview implements vscode.WebviewViewProvider { } })); + this._disposables.push(vscode.workspace.onDidChangeWorkspaceFolders((event) => { + this.sendCurrentProjectInfo(); + })); + // this._disposables.push(vscode.workspace.onDidOpenTextDocument((event) => { // console.log("onDidOpenTextDocument"); @@ -848,6 +853,11 @@ export class PanelWebview implements vscode.WebviewViewProvider { } } + sendCurrentProjectInfo() { + const action = setCurrentProjectInfo({name: vscode.workspace.name ?? ""}); + this._view?.webview.postMessage(action); + } + async createInitialState(thread?: ChatThread, tabbed = false): Promise> { const fontSize = vscode.workspace.getConfiguration().get("editor.fontSize") ?? 12; @@ -887,6 +897,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { }; const state: Partial = { + current_project: {name: vscode.workspace.name ?? ""}, config, };