File tree 5 files changed +14
-14
lines changed
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 {
20
20
waitUntilDebuggerAttaches,
21
21
} ) ;
22
22
} ,
23
- async getDebuggerPackagePath ( ) : Promise < string | undefined > {
23
+ async getDebuggerPackagePath ( ) : Promise < string > {
24
24
return getDebugpyPackagePath ( ) ;
25
25
} ,
26
26
} ,
Original file line number Diff line number Diff line change 1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT License.
3
3
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
-
9
4
export 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
- */
15
5
debug : {
16
6
/**
17
7
* 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';
15
15
import { registerLogger , traceError , traceLog } from './common/log/logging' ;
16
16
import { sendTelemetryEvent } from './telemetry' ;
17
17
import { EventName } from './telemetry/constants' ;
18
+ import { IExtensionApi } from './apiTypes' ;
18
19
19
20
// this method is called when your extension is activated
20
21
// 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 ;
22
24
// Setup logging
23
25
const outputChannel = createOutputChannel ( 'Python Debugger' ) ;
24
26
context . subscriptions . push ( outputChannel , registerLogger ( outputChannel ) ) ;
@@ -28,11 +30,14 @@ export async function activate(context: IExtensionContext): Promise<void> {
28
30
traceLog ( `Module: debugpy` ) ;
29
31
30
32
try {
31
- await registerDebugger ( context ) ;
33
+ api = await registerDebugger ( context ) ;
32
34
sendTelemetryEvent ( EventName . DEBUG_SUCCESS_ACTIVATION ) ;
33
35
} catch ( ex ) {
34
36
traceError ( 'sendDebugpySuccessActivationTelemetry() failed.' , ex ) ;
37
+ throw ex ; // re-raise
35
38
}
39
+
40
+ return api ;
36
41
}
37
42
38
43
// 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
35
35
import { getConfigurationsByUri } from './debugger/configuration/launch.json/launchJsonReader' ;
36
36
import { DebugpySocketsHandler } from './debugger/hooks/debugpySocketsHandler' ;
37
37
import { openReportIssue } from './common/application/commands/reportIssueCommand' ;
38
+ import { buildApi } from './api' ;
39
+ import { IExtensionApi } from './apiTypes' ;
38
40
39
- export async function registerDebugger ( context : IExtensionContext ) : Promise < void > {
41
+ export async function registerDebugger ( context : IExtensionContext ) : Promise < IExtensionApi > {
40
42
const childProcessAttachService = new ChildProcessAttachService ( ) ;
41
43
const childProcessAttachEventHandler = new ChildProcessAttachEventHandler ( childProcessAttachService ) ;
42
44
@@ -172,4 +174,6 @@ export async function registerDebugger(context: IExtensionContext): Promise<void
172
174
debugPortAttributesProvider . resetPortAttribute ( ) ;
173
175
} ) ,
174
176
) ;
177
+
178
+ return buildApi ( ) ;
175
179
}
Original file line number Diff line number Diff line change 9
9
" ES2019" ,
10
10
" ES2020"
11
11
],
12
+ "typeRoots" : [" ./node_modules/@types" ],
12
13
"sourceMap" : true ,
13
14
"typeRoots" : [
14
15
" ./node_modules/@types"
You can’t perform that action at this time.
0 commit comments