forked from continuedev/continue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivate.ts
70 lines (64 loc) · 2.24 KB
/
activate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { getTsConfigPath, migrate } from "core/util/paths";
import { Telemetry } from "core/util/posthog";
import path from "path";
import * as vscode from "vscode";
import { VsCodeExtension } from "../extension/vscodeExtension";
import registerQuickFixProvider from "../lang-server/codeActions";
import { getExtensionVersion } from "../util/util";
import { getExtensionUri } from "../util/vscode";
import { setupInlineTips } from "./inlineTips";
function showRefactorMigrationMessage(
extensionContext: vscode.ExtensionContext,
) {
// Only if the vscode setting continue.manuallyRunningSserver is true
const manuallyRunningServer =
vscode.workspace
.getConfiguration("continue")
.get<boolean>("manuallyRunningServer") || false;
if (
manuallyRunningServer &&
extensionContext?.globalState.get<boolean>(
"continue.showRefactorMigrationMessage",
) !== false
) {
vscode.window
.showInformationMessage(
"The Continue server protocol was recently updated in a way that requires the latest server version to work properly. Since you are manually running the server, please be sure to upgrade with `pip install --upgrade continuedev`.",
"Got it",
"Don't show again",
)
.then((selection) => {
if (selection === "Don't show again") {
// Get the global state
extensionContext?.globalState.update(
"continue.showRefactorMigrationMessage",
false,
);
}
});
}
}
export async function activateExtension(context: vscode.ExtensionContext) {
// Add necessary files
getTsConfigPath();
// Register commands and providers
registerQuickFixProvider();
setupInlineTips(context);
showRefactorMigrationMessage(context);
const vscodeExtension = new VsCodeExtension(context);
migrate("showWelcome_1", () => {
vscode.commands.executeCommand(
"markdown.showPreview",
vscode.Uri.file(
path.join(getExtensionUri().fsPath, "media", "welcome.md"),
),
);
});
// Load Continue configuration
if (!context.globalState.get("hasBeenInstalled")) {
context.globalState.update("hasBeenInstalled", true);
Telemetry.capture("install", {
extensionVersion: getExtensionVersion(),
});
}
}