summaryrefslogtreecommitdiff
path: root/extension/src/extension.ts
blob: e0b94278d518e17e368b4bcd0b6be7789434720b (plain)
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
/**
 * This is the entry point for the extension.
 */

import * as vscode from "vscode";
import {
  setupExtensionEnvironment,
  isPythonEnvSetup,
  startContinuePythonServer,
} from "./activation/environmentSetup";

async function dynamicImportAndActivate(
  context: vscode.ExtensionContext,
  showTutorial: boolean
) {
  const { activateExtension } = await import("./activation/activate");
  activateExtension(context, showTutorial);
}

export function activate(context: vscode.ExtensionContext) {
  // Only show progress if we have to setup
  vscode.window.withProgress(
    {
      location: vscode.ProgressLocation.Notification,
      title: "Setting up Continue extension...",
      cancellable: false,
    },
    async () => {
      if (isPythonEnvSetup()) {
        await startContinuePythonServer();
      } else {
        await setupExtensionEnvironment();
      }
      dynamicImportAndActivate(context, true);
    }
  );
}