Skip to content

Commit 0791e3e

Browse files
committed
Move Continue startup to be part of the extension, not the connection
Signed-off-by: worksofliam <[email protected]>
1 parent e87cf27 commit 0791e3e

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/aiProviders/copilot/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ interface IDB2ChatResult extends vscode.ChatResult {
1717
};
1818
}
1919

20+
export async function registerCopilotProvider(context: vscode.ExtensionContext) {
21+
const copilot = vscode.extensions.getExtension(`github.copilot-chat`);
22+
23+
if (copilot) {
24+
if (!copilot.isActive) {
25+
await copilot.activate()
26+
}
27+
28+
activateChat(context);
29+
}
30+
}
31+
2032
export function activateChat(context: vscode.ExtensionContext) {
2133
// chatHandler deals with the input from the chat windows,
2234
// and uses streamModelResponse to send the response back to the chat window

src/extension.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { JobManagerView } from "./views/jobManager/jobManagerView";
2323
import { SelfTreeDecorationProvider, selfCodesResultsView } from "./views/jobManager/selfCodes/selfCodesResultsView";
2424
import { registerContinueProvider } from "./aiProviders/continue/continueContextProvider";
2525
import { queryHistory } from "./views/queryHistoryView";
26-
import { activateChat } from "./aiProviders/copilot";
26+
import { activateChat, registerCopilotProvider } from "./aiProviders/copilot";
2727

2828
export interface Db2i {
2929
sqlJobManager: SQLJobManager,
@@ -94,8 +94,6 @@ export function activate(context: vscode.ExtensionContext): Db2i {
9494
DbCache.resetCache();
9595
selfCodesView.setRefreshEnabled(false);
9696
selfCodesView.setJobOnly(false);
97-
// register continue provider
98-
registerContinueProvider();
9997
// Refresh the examples when we have it, so we only display certain examples
10098
onConnectOrServerInstall().then(() => {
10199
exampleBrowser.refresh();
@@ -106,17 +104,11 @@ export function activate(context: vscode.ExtensionContext): Db2i {
106104
});
107105
});
108106

109-
const copilot = vscode.extensions.getExtension(`github.copilot-chat`);
110107

111-
if (copilot) {
112-
if (!copilot.isActive) {
113-
copilot.activate().then(() => {
114-
activateChat(context);
115-
});
116-
} else {
117-
activateChat(context);
118-
}
119-
}
108+
// register copilot provider
109+
registerCopilotProvider(context);
110+
// register continue provider
111+
registerContinueProvider();
120112

121113
instance.subscribe(context, `disconnected`, `db2i-disconnected`, () => ServerComponent.reset());
122114

0 commit comments

Comments
 (0)