diff --git a/src/extension/api.ts b/src/extension/api.ts index acc4164e..e355b0f5 100644 --- a/src/extension/api.ts +++ b/src/extension/api.ts @@ -20,7 +20,7 @@ export function buildApi(): IExtensionApi { waitUntilDebuggerAttaches, }); }, - async getDebuggerPackagePath(): Promise { + async getDebuggerPackagePath(): Promise { return getDebugpyPackagePath(); }, }, diff --git a/src/extension/apiTypes.ts b/src/extension/apiTypes.ts index 409d41ef..6de5eb4a 100644 --- a/src/extension/apiTypes.ts +++ b/src/extension/apiTypes.ts @@ -1,17 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -/* - * Do not introduce any breaking changes to this API. - * This is the public API for other extensions to interact with this extension. - */ - export interface IExtensionApi { - /** - * Promise indicating whether all parts of the extension have completed loading or not. - * @type {Promise} - * @memberof IExtensionApi - */ debug: { /** * Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging. diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 1829bc61..248d77d9 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -15,10 +15,12 @@ import { Commands } from './common/constants'; import { registerLogger, traceError, traceLog } from './common/log/logging'; import { sendTelemetryEvent } from './telemetry'; import { EventName } from './telemetry/constants'; +import { IExtensionApi } from './apiTypes'; // this method is called when your extension is activated // your extension is activated the very first time the command is executed -export async function activate(context: IExtensionContext): Promise { +export async function activate(context: IExtensionContext): Promise { + let api: IExtensionApi; // Setup logging const outputChannel = createOutputChannel('Python Debugger'); context.subscriptions.push(outputChannel, registerLogger(outputChannel)); @@ -28,11 +30,14 @@ export async function activate(context: IExtensionContext): Promise { traceLog(`Module: debugpy`); try { - await registerDebugger(context); + api = await registerDebugger(context); sendTelemetryEvent(EventName.DEBUG_SUCCESS_ACTIVATION); } catch (ex) { traceError('sendDebugpySuccessActivationTelemetry() failed.', ex); + throw ex; // re-raise } + + return api; } // this method is called when your extension is deactivated diff --git a/src/extension/extensionInit.ts b/src/extension/extensionInit.ts index 92128dfa..7112941b 100644 --- a/src/extension/extensionInit.ts +++ b/src/extension/extensionInit.ts @@ -35,8 +35,10 @@ import { DebugPortAttributesProvider } from './debugger/debugPort/portAttributes import { getConfigurationsByUri } from './debugger/configuration/launch.json/launchJsonReader'; import { DebugpySocketsHandler } from './debugger/hooks/debugpySocketsHandler'; import { openReportIssue } from './common/application/commands/reportIssueCommand'; +import { buildApi } from './api'; +import { IExtensionApi } from './apiTypes'; -export async function registerDebugger(context: IExtensionContext): Promise { +export async function registerDebugger(context: IExtensionContext): Promise { const childProcessAttachService = new ChildProcessAttachService(); const childProcessAttachEventHandler = new ChildProcessAttachEventHandler(childProcessAttachService); @@ -172,4 +174,6 @@ export async function registerDebugger(context: IExtensionContext): Promise