Skip to content

Commit d6e4513

Browse files
1 parent 6c56409 commit d6e4513

29 files changed

+2493
-2040
lines changed

Source/extension/api.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
'use strict';
4+
"use strict";
55

6-
import { IExtensionApi } from './apiTypes';
7-
import { getDebugpyLauncherArgs, getDebugpyPackagePath } from './debugger/adapter/remoteLaunchers';
6+
import { IExtensionApi } from "./apiTypes";
7+
import {
8+
getDebugpyLauncherArgs,
9+
getDebugpyPackagePath,
10+
} from "./debugger/adapter/remoteLaunchers";
811

912
export function buildApi(): IExtensionApi {
10-
const api: IExtensionApi = {
11-
debug: {
12-
async getRemoteLauncherCommand(
13-
host: string,
14-
port: number,
15-
waitUntilDebuggerAttaches: boolean = true,
16-
): Promise<string[]> {
17-
return getDebugpyLauncherArgs({
18-
host,
19-
port,
20-
waitUntilDebuggerAttaches,
21-
});
22-
},
23-
async getDebuggerPackagePath(): Promise<string> {
24-
return getDebugpyPackagePath();
25-
},
26-
},
27-
};
13+
const api: IExtensionApi = {
14+
debug: {
15+
async getRemoteLauncherCommand(
16+
host: string,
17+
port: number,
18+
waitUntilDebuggerAttaches: boolean = true,
19+
): Promise<string[]> {
20+
return getDebugpyLauncherArgs({
21+
host,
22+
port,
23+
waitUntilDebuggerAttaches,
24+
});
25+
},
26+
async getDebuggerPackagePath(): Promise<string> {
27+
return getDebugpyPackagePath();
28+
},
29+
},
30+
};
2831

29-
return api;
32+
return api;
3033
}

Source/extension/apiTypes.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22
// Licensed under the MIT License.
33

44
export interface IExtensionApi {
5-
debug: {
6-
/**
7-
* Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging.
8-
* Users can append another array of strings of what they want to execute along with relevant arguments to Python.
9-
* E.g `['/Users/..../pythonVSCode/pythonFiles/lib/python/debugpy', '--listen', 'localhost:57039', '--wait-for-client']`
10-
* @param {string} host
11-
* @param {number} port
12-
* @param {boolean} [waitUntilDebuggerAttaches=true]
13-
* @returns {Promise<string[]>}
14-
*/
15-
getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches: boolean): Promise<string[]>;
5+
debug: {
6+
/**
7+
* Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging.
8+
* Users can append another array of strings of what they want to execute along with relevant arguments to Python.
9+
* E.g `['/Users/..../pythonVSCode/pythonFiles/lib/python/debugpy', '--listen', 'localhost:57039', '--wait-for-client']`
10+
* @param {string} host
11+
* @param {number} port
12+
* @param {boolean} [waitUntilDebuggerAttaches=true]
13+
* @returns {Promise<string[]>}
14+
*/
15+
getRemoteLauncherCommand(
16+
host: string,
17+
port: number,
18+
waitUntilDebuggerAttaches: boolean,
19+
): Promise<string[]>;
1620

17-
/**
18-
* Gets the path to the debugger package used by the extension.
19-
* @returns {Promise<string>}
20-
*/
21-
getDebuggerPackagePath(): Promise<string | undefined>;
22-
};
21+
/**
22+
* Gets the path to the debugger package used by the extension.
23+
* @returns {Promise<string>}
24+
*/
25+
getDebuggerPackagePath(): Promise<string | undefined>;
26+
};
2327
}

Source/extension/common/constants.ts

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,34 @@
22
// Copyright (c) Microsoft Corporation. All rights reserved.
33
// Licensed under the MIT License.
44

5-
import * as path from 'path';
5+
import * as path from "path";
66

7-
export const PYTHON_LANGUAGE = 'python';
7+
export const PYTHON_LANGUAGE = "python";
88
const folderName = path.basename(__dirname);
99
export const EXTENSION_ROOT_DIR =
10-
folderName === 'common' ? path.dirname(path.dirname(path.dirname(__dirname))) : path.dirname(__dirname);
11-
export const BUNDLED_PYTHON_SCRIPTS_DIR = path.join(EXTENSION_ROOT_DIR, 'bundled');
12-
export const SERVER_SCRIPT_PATH = path.join(BUNDLED_PYTHON_SCRIPTS_DIR, 'tool', `server.py`);
13-
export const DEBUG_SERVER_SCRIPT_PATH = path.join(BUNDLED_PYTHON_SCRIPTS_DIR, 'tool', `_debug_server.py`);
10+
folderName === "common"
11+
? path.dirname(path.dirname(path.dirname(__dirname)))
12+
: path.dirname(__dirname);
13+
export const BUNDLED_PYTHON_SCRIPTS_DIR = path.join(
14+
EXTENSION_ROOT_DIR,
15+
"bundled",
16+
);
17+
export const SERVER_SCRIPT_PATH = path.join(
18+
BUNDLED_PYTHON_SCRIPTS_DIR,
19+
"tool",
20+
`server.py`,
21+
);
22+
export const DEBUG_SERVER_SCRIPT_PATH = path.join(
23+
BUNDLED_PYTHON_SCRIPTS_DIR,
24+
"tool",
25+
`_debug_server.py`,
26+
);
1427

15-
export const AppinsightsKey = '0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255';
28+
export const AppinsightsKey =
29+
"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255";
1630

1731
export function isTestExecution(): boolean {
18-
return process.env.VSC_PYTHON_CI_TEST === '1' || isUnitTestExecution();
32+
return process.env.VSC_PYTHON_CI_TEST === "1" || isUnitTestExecution();
1933
}
2034

2135
/**
@@ -25,21 +39,22 @@ export function isTestExecution(): boolean {
2539
* @returns {boolean}
2640
*/
2741
export function isUnitTestExecution(): boolean {
28-
return process.env.VSC_PYTHON_UNIT_TEST === '1';
42+
return process.env.VSC_PYTHON_UNIT_TEST === "1";
2943
}
3044

3145
export namespace Commands {
32-
export const Debug_In_Terminal = 'debugpy.debugInTerminal';
33-
export const Debug_Using_Launch_Config = 'debugpy.debugUsingLaunchConfig';
34-
export const TriggerEnvironmentSelection = 'debugpy.triggerEnvSelection';
35-
export const PickLocalProcess = 'debugpy.pickLocalProcess';
36-
export const PickArguments = 'debugpy.pickArgs';
37-
export const ViewOutput = 'debugpy.viewOutput';
38-
export const ClearStorage = 'debugpy.clearCacheAndReload';
39-
export const Enable_SourceMap_Support = 'debugpy.enableSourceMapSupport';
40-
export const SelectDebugConfig = 'debugpy.SelectAndInsertDebugConfiguration';
41-
export const Set_Interpreter = 'python.setInterpreter';
42-
export const ReportIssue = 'debugpy.reportIssue';
46+
export const Debug_In_Terminal = "debugpy.debugInTerminal";
47+
export const Debug_Using_Launch_Config = "debugpy.debugUsingLaunchConfig";
48+
export const TriggerEnvironmentSelection = "debugpy.triggerEnvSelection";
49+
export const PickLocalProcess = "debugpy.pickLocalProcess";
50+
export const PickArguments = "debugpy.pickArgs";
51+
export const ViewOutput = "debugpy.viewOutput";
52+
export const ClearStorage = "debugpy.clearCacheAndReload";
53+
export const Enable_SourceMap_Support = "debugpy.enableSourceMapSupport";
54+
export const SelectDebugConfig =
55+
"debugpy.SelectAndInsertDebugConfiguration";
56+
export const Set_Interpreter = "python.setInterpreter";
57+
export const ReportIssue = "debugpy.reportIssue";
4358
}
4459

45-
export type Channel = 'stable' | 'insiders';
60+
export type Channel = "stable" | "insiders";

0 commit comments

Comments
 (0)