(vscodeExt: vscode.ExtensionContext)
| 8 | |
| 9 | // activate run on vscode extension initialization |
| 10 | export 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 |
| 48 | export const deactivate = (): void => onDeactivate() |
nothing calls this directly
no test coverage detected