MCPcopy Index your code
hub / github.com/coderoad/coderoad-vscode / activate

Function activate

src/extension.ts:10–45  ·  view source on GitHub ↗
(vscodeExt: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

8
9// activate run on vscode extension initialization
10export const activate = (vscodeExt: vscode.ExtensionContext): void => {
11 // set out default 60/40 layout
12 vscode.commands.executeCommand('vscode.setEditorLayout', {
13 orientation: 0,
14 groups: [{ size: 0.6 }, { size: 0.4 }],
15 })
16
17 // commands
18 const commands = createCommands({
19 extensionPath: vscodeExt.extensionPath,
20 // NOTE: local storage must be bound to the vscodeExt.workspaceState
21 workspaceState: vscodeExt.workspaceState,
22 })
23
24 const subscribe = (sub: any) => {
25 vscodeExt.subscriptions.push(sub)
26 }
27
28 // register commands
29 for (const cmd in commands) {
30 const command: vscode.Disposable = vscode.commands.registerCommand(cmd, commands[cmd])
31 subscribe(command)
32 }
33
34 telemetry.activate(subscribe)
35
36 onDeactivate = () => {
37 // cleanup subscriptions/tasks
38 // handled within activate because it requires access to subscriptions
39 for (const disposable of vscodeExt.subscriptions) {
40 disposable.dispose()
41 }
42
43 telemetry.deactivate()
44 }
45}
46
47// deactivate run on vscode extension shut down
48export const deactivate = (): void => onDeactivate()

Callers

nothing calls this directly

Calls 4

createCommandsFunction · 0.90
subscribeFunction · 0.85
activateMethod · 0.80
deactivateMethod · 0.80

Tested by

no test coverage detected