Skip to content

Commit e1eba13

Browse files
committed
bugfix(chat): show chat view only if chat enabled
1 parent 8f252fa commit e1eba13

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"type": "webview",
4747
"id": "firecoder.chat-gui",
4848
"name": "",
49-
"visibility": "visible"
49+
"visibility": "visible",
50+
"when": "config.firecoder.experimental.chat"
5051
}
5152
]
5253
},

src/extension.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@ export async function activate(context: vscode.ExtensionContext) {
1919
sendTelemetry: true,
2020
});
2121

22-
const provider = new ChatPanel(context.extensionUri);
23-
context.subscriptions.push(
24-
vscode.window.registerWebviewViewProvider("firecoder.chat-gui", provider, {
25-
webviewOptions: { retainContextWhenHidden: true },
26-
})
27-
);
22+
const isChatEnabled = configuration.get("experimental.chat");
23+
24+
if (isChatEnabled) {
25+
const provider = new ChatPanel(context.extensionUri);
26+
context.subscriptions.push(
27+
vscode.window.registerWebviewViewProvider(
28+
"firecoder.chat-gui",
29+
provider,
30+
{
31+
webviewOptions: { retainContextWhenHidden: true },
32+
}
33+
)
34+
);
35+
context.subscriptions.push(
36+
vscode.commands.registerCommand("firecoder.startNewChat", async () => {
37+
await provider.sendMessageToWebview("startNewChat", {});
38+
})
39+
);
40+
}
2841

2942
statusBar.init(context);
3043

@@ -44,12 +57,6 @@ export async function activate(context: vscode.ExtensionContext) {
4457
)
4558
);
4659

47-
context.subscriptions.push(
48-
vscode.commands.registerCommand("firecoder.startNewChat", async () => {
49-
await provider.sendMessageToWebview("startNewChat", {});
50-
})
51-
);
52-
5360
context.subscriptions.push(
5461
vscode.commands.registerCommand("firecoder.inlineSuggest", async () => {
5562
await vscode.commands.executeCommand(
@@ -65,9 +72,7 @@ export async function activate(context: vscode.ExtensionContext) {
6572
...new Set([
6673
configuration.get("completion.autoMode"),
6774
configuration.get("completion.manuallyMode"),
68-
...(configuration.get("experimental.chat")
69-
? ["chat-medium" as const]
70-
: []),
75+
...(isChatEnabled ? ["chat-medium" as const] : []),
7176
]),
7277
].map((serverType) => servers[serverType].startServer())
7378
);

0 commit comments

Comments
 (0)