All files / src extension.ts

95.38% Statements 62/65
100% Branches 1/1
50% Functions 1/2
95.38% Lines 62/65

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 661x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x        
import * as vscode from "vscode";
import {
  fetchSettingsCommand,
  incorrectChoicesCommand,
  testFetchCommand,
} from "./commands/test-commands";
import {
  uriHandlerCommand,
  signInCommand,
  signOutCommand,
  createAuthStatusBarItem,
} from "./commands/auth-commands";
import { registerSuggestionCommands } from "./commands/suggestion-commands";
import { inlineCompletionProvider } from "./commands/completion-provider";
import { checkUserSignIn } from "./services/auth-service";
import {
  registerClassSelectorCommand,
  setupClassStatusBarItem,
} from "./utils/userClass";
 
/**
 * Global extension context shared across the entire lifecycle of the VS Code extension.
 * This context is used to store global state, manage subscriptions, and access workspace-specific configurations.
 */
export let globalContext: vscode.ExtensionContext;
 
/**
 * Cleanup handler invoked when the extension is deactivated.
 *
 * This function is called by the VS Code runtime when the extension is deactivated,
 * such as when the user disables the extension or when VS Code is shutting down.
 * It is used to perform any necessary cleanup, such as disposing resources or saving state.
 */
export async function activate(context: vscode.ExtensionContext) {
  globalContext = context;
 
  console.log("CLOVER Activated");
 
  await checkUserSignIn();
 
  const authButtonStatusBar = await setupClassStatusBarItem();
  registerClassSelectorCommand(context, authButtonStatusBar);
 
  const authStatusBar = createAuthStatusBarItem(context);
  const suggestionCommands = registerSuggestionCommands();
 
  context.subscriptions.push(
    ...suggestionCommands,
    authStatusBar,
    incorrectChoicesCommand,
    signInCommand,
    signOutCommand,
    uriHandlerCommand,
    testFetchCommand,
    inlineCompletionProvider,
    fetchSettingsCommand
  );
}
/**
 * Called when the extension is deactivated.
 * Used for any necessary cleanup (currently logs deactivation to the console).
 */
export function deactivate() {
  console.log("AI Extension Deactivated");
}