File tree Expand file tree Collapse file tree 5 files changed +14
-14
lines changed Expand file tree Collapse file tree 5 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export function buildApi(): IExtensionApi {
2020 waitUntilDebuggerAttaches,
2121 } ) ;
2222 } ,
23- async getDebuggerPackagePath ( ) : Promise < string | undefined > {
23+ async getDebuggerPackagePath ( ) : Promise < string > {
2424 return getDebugpyPackagePath ( ) ;
2525 } ,
2626 } ,
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4- /*
5- * Do not introduce any breaking changes to this API.
6- * This is the public API for other extensions to interact with this extension.
7- */
8-
94export interface IExtensionApi {
10- /**
11- * Promise indicating whether all parts of the extension have completed loading or not.
12- * @type {Promise<void> }
13- * @memberof IExtensionApi
14- */
155 debug : {
166 /**
177 * Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging.
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ import { Commands } from './common/constants';
1515import { registerLogger , traceError , traceLog } from './common/log/logging' ;
1616import { sendTelemetryEvent } from './telemetry' ;
1717import { EventName } from './telemetry/constants' ;
18+ import { IExtensionApi } from './apiTypes' ;
1819
1920// this method is called when your extension is activated
2021// your extension is activated the very first time the command is executed
21- export async function activate ( context : IExtensionContext ) : Promise < void > {
22+ export async function activate ( context : IExtensionContext ) : Promise < IExtensionApi > {
23+ let api : IExtensionApi ;
2224 // Setup logging
2325 const outputChannel = createOutputChannel ( 'Python Debugger' ) ;
2426 context . subscriptions . push ( outputChannel , registerLogger ( outputChannel ) ) ;
@@ -28,11 +30,14 @@ export async function activate(context: IExtensionContext): Promise<void> {
2830 traceLog ( `Module: debugpy` ) ;
2931
3032 try {
31- await registerDebugger ( context ) ;
33+ api = await registerDebugger ( context ) ;
3234 sendTelemetryEvent ( EventName . DEBUG_SUCCESS_ACTIVATION ) ;
3335 } catch ( ex ) {
3436 traceError ( 'sendDebugpySuccessActivationTelemetry() failed.' , ex ) ;
37+ throw ex ; // re-raise
3538 }
39+
40+ return api ;
3641}
3742
3843// this method is called when your extension is deactivated
Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ import { DebugPortAttributesProvider } from './debugger/debugPort/portAttributes
3535import { getConfigurationsByUri } from './debugger/configuration/launch.json/launchJsonReader' ;
3636import { DebugpySocketsHandler } from './debugger/hooks/debugpySocketsHandler' ;
3737import { openReportIssue } from './common/application/commands/reportIssueCommand' ;
38+ import { buildApi } from './api' ;
39+ import { IExtensionApi } from './apiTypes' ;
3840
39- export async function registerDebugger ( context : IExtensionContext ) : Promise < void > {
41+ export async function registerDebugger ( context : IExtensionContext ) : Promise < IExtensionApi > {
4042 const childProcessAttachService = new ChildProcessAttachService ( ) ;
4143 const childProcessAttachEventHandler = new ChildProcessAttachEventHandler ( childProcessAttachService ) ;
4244
@@ -172,4 +174,6 @@ export async function registerDebugger(context: IExtensionContext): Promise<void
172174 debugPortAttributesProvider . resetPortAttribute ( ) ;
173175 } ) ,
174176 ) ;
177+
178+ return buildApi ( ) ;
175179}
Original file line number Diff line number Diff line change 99 " ES2019" ,
1010 " ES2020"
1111 ],
12+ "typeRoots" : [" ./node_modules/@types" ],
1213 "sourceMap" : true ,
1314 "typeRoots" : [
1415 " ./node_modules/@types"
You can’t perform that action at this time.
0 commit comments