MCPcopy
hub / github.com/microsoft/vscode-js-debug / activate

Function activate

src/extension.ts:35–114  ·  view source on GitHub ↗
(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

33import { VSCodeSessionManager } from './ui/vsCodeSessionManager';
34
35export 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 =>

Callers

nothing calls this directly

Calls 15

terminateMethod · 0.95
createGlobalContainerFunction · 0.90
registerCommandFunction · 0.90
pickProcessFunction · 0.90
registerDebugTerminalUIFunction · 0.90
registerProfilingCommandFunction · 0.90
registerAutoAttachFunction · 0.90
registerRevealPageFunction · 0.90
registerRequestCDPProxyFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected