(context: vscode.ExtensionContext)
| 33 | import { VSCodeSessionManager } from './ui/vsCodeSessionManager'; |
| 34 | |
| 35 | export function activate(context: vscode.ExtensionContext): IExports { |
| 36 | if (vscode.l10n.bundle) { |
| 37 | l10n.config({ contents: vscode.l10n.bundle }); |
| 38 | } |
| 39 | |
| 40 | const services = createGlobalContainer({ |
| 41 | // On Windows, use the os.tmpdir() since the extension storage path is too long. See: |
| 42 | // https://github.com/microsoft/vscode-js-debug/issues/342 |
| 43 | storagePath: process.platform === 'win32' |
| 44 | ? tmpdir() |
| 45 | : context.storagePath || context.extensionPath, |
| 46 | isVsCode: true, |
| 47 | isRemote: !!process.env.JS_DEBUG_USE_COMPANION |
| 48 | || vscode.extensions.getExtension(extensionId)?.extensionKind |
| 49 | === vscode.ExtensionKind.Workspace, |
| 50 | context, |
| 51 | }); |
| 52 | |
| 53 | context.subscriptions.push( |
| 54 | registerCommand(vscode.commands, Commands.DebugNpmScript, debugNpmScript), |
| 55 | registerCommand(vscode.commands, Commands.PickProcess, async () => { |
| 56 | const pick = await pickProcess(); |
| 57 | if (!pick) { |
| 58 | throw new vscode.CancellationError(); |
| 59 | } |
| 60 | return pick; |
| 61 | }), |
| 62 | registerCommand(vscode.commands, Commands.AttachProcess, attachProcess), |
| 63 | registerCommand(vscode.commands, Commands.ToggleSkipping, toggleSkippingFile), |
| 64 | ); |
| 65 | |
| 66 | const debugResolvers = services.getAll<IDebugConfigurationResolver>(IDebugConfigurationResolver); |
| 67 | for (const resolver of debugResolvers) { |
| 68 | const cast = resolver as vscode.DebugConfigurationProvider; |
| 69 | context.subscriptions.push( |
| 70 | vscode.debug.registerDebugConfigurationProvider(resolver.type, cast), |
| 71 | ); |
| 72 | |
| 73 | const preferred = preferredDebugTypes.get(resolver.type as DebugType); |
| 74 | if (preferred) { |
| 75 | context.subscriptions.push( |
| 76 | vscode.debug.registerDebugConfigurationProvider(preferred, cast), |
| 77 | ); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | const debugProviders = services.getAll<IDebugConfigurationProvider>(IDebugConfigurationProvider); |
| 82 | for (const provider of debugProviders) { |
| 83 | vscode.debug.registerDebugConfigurationProvider( |
| 84 | provider.type, |
| 85 | provider as vscode.DebugConfigurationProvider, |
| 86 | vscode.DebugConfigurationProviderTriggerKind !== undefined ? provider.triggerKind : undefined, |
| 87 | ); |
| 88 | } |
| 89 | |
| 90 | const sessionManager = new VSCodeSessionManager(services); |
| 91 | context.subscriptions.push( |
| 92 | ...[...allDebugTypes].map(type => |
nothing calls this directly
no test coverage detected