diff --git a/README.md b/README.md index 960278fc..c4555200 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# Debugpy extension for Visual Studio Code +# Python Debugger extension for Visual Studio Code -A [Visual Studio Code](https://code.visualstudio.com/) [extension](https://marketplace.visualstudio.com/VSCode) that supports Python debugging with debugpy. debugpy provides a seamless debugging experience by allowing you to set breakpoints, step through code, inspect variables, and perform other essential debugging tasks. The debugy extension offers debugging support for various types of Python applications including scripts, web applications, remote processes, and multi-threaded processes. +A [Visual Studio Code](https://code.visualstudio.com/) [extension](https://marketplace.visualstudio.com/VSCode) that supports Python debugging with debugpy. Python Debugger provides a seamless debugging experience by allowing you to set breakpoints, step through code, inspect variables, and perform other essential debugging tasks. The debugy extension offers debugging support for various types of Python applications including scripts, web applications, remote processes, and multi-threaded processes. Note: -- The Python extension offers the debugpy extension as an optional installation, including it during the setup process. +- The Python extension offers the python debugger extension as an optional installation, including it during the setup process. - This extension is supported for all [actively supported versions](https://devguide.python.org/#status-of-python-branches) of the Python language (i.e., Python >= 3.7). ## Usage -Once installed in Visual Studio Code, debugpy will be automatically activated when you open a Python file. +Once installed in Visual Studio Code, python-debugger will be automatically activated when you open a Python file. -## Disabling the Debugpy extension -If you want to disable the Debugpy extension, you can [disable this extension](https://code.visualstudio.com/docs/editor/extension-marketplace#_disable-an-extension) per workspace in Visual Studio Code. +## Disabling the Python Debugger extension +If you want to disable the Python Debugger extension, you can [disable this extension](https://code.visualstudio.com/docs/editor/extension-marketplace#_disable-an-extension) per workspace in Visual Studio Code. ## Commands | Command | Description | | ---------------------- | --------------------------------- | -| Debugpy: viewOutput | Show the debugpy extension output. | -| Debugpy: clearCacheAndReload | Allows you to clear the global values set in the extension. | -| Debugpy: debugInTerminal | Allows you to debug a simple Python file in the terminal. | +| Python Debugger: viewOutput | Show the Python Debugger Extension output. | +| Python Debugger: clearCacheAndReload | Allows you to clear the global values set in the extension. | +| Python Debugger: debugInTerminal | Allows you to debug a simple Python file in the terminal. | ## Data and telemetry The Debubpy Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](https://privacy.microsoft.com/privacystatement) to learn more. This extension respects the `telemetry.enableTelemetry` setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting. diff --git a/package.json b/package.json index b4eb630b..87a7a181 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "debugpy", - "displayName": "Debugpy", + "displayName": "Python Debugger", "description": "Python Debugger extension using `debugpy`.", "version": "2023.3.0-dev", "publisher": "ms-python", @@ -39,18 +39,18 @@ "contributes": { "commands": [ { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.debugInTerminal", "icon": "$(debug-alt)", "title": "%debugpy.command.debugInTerminal.title%" }, { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.clearCacheAndReload", "title": "%debugpy.command.clearCacheAndReload.title%" }, { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.viewOutput", "icon": { "dark": "resources/dark/repl.svg", @@ -62,18 +62,18 @@ "menus": { "commandPalette": [ { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.clearCacheAndReload", "title": "%debugpy.command.clearCacheAndReload.title%" }, { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.debugInTerminal", "icon": "$(debug-alt)", "title": "%debugpy.command.debugInTerminal.title%" }, { - "category": "Debugpy", + "category": "Python Debugger", "command": "debugpy.viewOutput", "title": "%debugpy.command.viewOutput.title%" } @@ -434,7 +434,7 @@ } }, "configurationSnippets": [], - "label": "Debugpy", + "label": "Python Debugger", "languages": [ "python" ], diff --git a/src/extension/common/utils/localize.ts b/src/extension/common/utils/localize.ts index 36346e9f..06b6fbdb 100644 --- a/src/extension/common/utils/localize.ts +++ b/src/extension/common/utils/localize.ts @@ -19,12 +19,12 @@ export namespace DebugConfigStrings { placeholder: l10n.t('Debug Configuration'), }; export const launchJsonCompletions = { - label: l10n.t('Debugpy'), - description: l10n.t('Select a Debugpy debug configuration'), + label: l10n.t('Python Debugger'), + description: l10n.t('Select a Python Debugger debug configuration'), }; export namespace file { export const snippet = { - name: l10n.t('Debugpy: Current File'), + name: l10n.t('Python Debugger: Current File'), }; export const selectConfiguration = { label: l10n.t('Python File'), @@ -33,7 +33,7 @@ export namespace DebugConfigStrings { } export namespace fileWithArgs { export const snippet = { - name: l10n.t('Debugpy: Current File with Arguments'), + name: l10n.t('Python Debugger: Current File with Arguments'), }; export const selectConfiguration = { label: l10n.t('Python File with Arguments'), @@ -42,7 +42,7 @@ export namespace DebugConfigStrings { } export namespace module { export const snippet = { - name: l10n.t('Debugpy: Module'), + name: l10n.t('Python Debugger: Module'), default: l10n.t('enter-your-module-name'), }; export const selectConfiguration = { @@ -58,7 +58,7 @@ export namespace DebugConfigStrings { } export namespace attach { export const snippet = { - name: l10n.t('Debugpy: Remote Attach'), + name: l10n.t('Python Debugger: Remote Attach'), }; export const selectConfiguration = { label: l10n.t('Remote Attach'), @@ -77,7 +77,7 @@ export namespace DebugConfigStrings { } export namespace attachPid { export const snippet = { - name: l10n.t('Debugpy: Attach using Process Id'), + name: l10n.t('Python Debugger: Attach using Process Id'), }; export const selectConfiguration = { label: l10n.t('Attach using Process ID'), @@ -86,7 +86,7 @@ export namespace DebugConfigStrings { } export namespace django { export const snippet = { - name: l10n.t('Debugpy: Django'), + name: l10n.t('Python Debugger: Django'), }; export const selectConfiguration = { label: l10n.t('Django'), @@ -102,7 +102,7 @@ export namespace DebugConfigStrings { } export namespace fastapi { export const snippet = { - name: l10n.t('Debugpy: FastAPI'), + name: l10n.t('Python Debugger: FastAPI'), }; export const selectConfiguration = { label: l10n.t('FastAPI'), @@ -116,7 +116,7 @@ export namespace DebugConfigStrings { } export namespace flask { export const snippet = { - name: l10n.t('Debugpy: Flask'), + name: l10n.t('Python Debugger: Flask'), }; export const selectConfiguration = { label: l10n.t('Flask'), @@ -124,13 +124,13 @@ export namespace DebugConfigStrings { }; export const enterAppPathOrNamePath = { title: l10n.t('Debug Flask'), - prompt: l10n.t('Debugpy: Flask'), + prompt: l10n.t('Python Debugger: Flask'), invalid: l10n.t('Enter a valid name'), }; } export namespace pyramid { export const snippet = { - name: l10n.t('Debugpy: Pyramid Application'), + name: l10n.t('Python Debugger: Pyramid Application'), }; export const selectConfiguration = { label: l10n.t('Pyramid'), diff --git a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts index 587783c9..29aac508 100644 --- a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts +++ b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts @@ -30,7 +30,7 @@ class OutdatedDebuggerPrompt implements DebugAdapterTracker { if (eventMessage.event === 'output') { const outputMessage = eventMessage as DebugProtocol.OutputEvent; if (outputMessage.body.category === 'telemetry') { - // debugpy sends telemetry as both ptvsd and debugpy. This was done to help with + // Python Debugger sends telemetry as both ptvsd and debugpy. This was done to help with // transition from ptvsd to debugpy while analyzing usage telemetry. if ( outputMessage.body.output === 'ptvsd' && diff --git a/src/extension/debugger/adapter/remoteLaunchers.ts b/src/extension/debugger/adapter/remoteLaunchers.ts index ccaf137f..2757b092 100644 --- a/src/extension/debugger/adapter/remoteLaunchers.ts +++ b/src/extension/debugger/adapter/remoteLaunchers.ts @@ -8,7 +8,7 @@ import '../../common/promiseUtils'; import { EXTENSION_ROOT_DIR } from '../../common/constants'; import { fileToCommandArgumentForPythonExt } from '../../common/stringUtils'; -const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python'); +const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'bundled', 'libs'); const pathToDebugger = path.join(pathToPythonLibDir, 'debugpy'); type RemoteDebugOptions = { diff --git a/src/extension/debugger/configuration/dynamicdebugConfigurationService.ts b/src/extension/debugger/configuration/dynamicdebugConfigurationService.ts index c0a92b42..20e75f79 100644 --- a/src/extension/debugger/configuration/dynamicdebugConfigurationService.ts +++ b/src/extension/debugger/configuration/dynamicdebugConfigurationService.ts @@ -23,7 +23,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf const providers = []; providers.push({ - name: 'Debugpy: Python File', + name: 'Python Debugger: Python File', type: DebuggerTypeName, request: 'launch', program: '${file}', @@ -33,7 +33,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf const djangoManagePath = await DynamicPythonDebugConfigurationService.getDjangoPath(folder); if (djangoManagePath) { providers.push({ - name: 'Debugpy: Django', + name: 'Python Debugger: Django', type: DebuggerTypeName, request: 'launch', program: `${workspaceFolderToken}${path.sep}${djangoManagePath}`, @@ -46,7 +46,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf const flaskPath = await DynamicPythonDebugConfigurationService.getFlaskPath(folder); if (flaskPath) { providers.push({ - name: 'Debugpy: Flask', + name: 'Python Debugger: Flask', type: DebuggerTypeName, request: 'launch', module: 'flask', @@ -64,7 +64,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf if (fastApiPath) { fastApiPath = replaceAll(path.relative(folder.uri.fsPath, fastApiPath), path.sep, '.').replace('.py', ''); providers.push({ - name: 'Debugpy: FastAPI', + name: 'Python Debugger: FastAPI', type: DebuggerTypeName, request: 'launch', module: 'uvicorn', diff --git a/src/extension/extension.ts b/src/extension/extension.ts index e4b4fb55..1829bc61 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -20,11 +20,11 @@ import { EventName } from './telemetry/constants'; // your extension is activated the very first time the command is executed export async function activate(context: IExtensionContext): Promise { // Setup logging - const outputChannel = createOutputChannel('Debugpy'); + const outputChannel = createOutputChannel('Python Debugger'); context.subscriptions.push(outputChannel, registerLogger(outputChannel)); context.subscriptions.push(registerCommand(Commands.ViewOutput, () => outputChannel.show())); - traceLog(`Name: Debugpy`); + traceLog(`Name: Python Debugger`); traceLog(`Module: debugpy`); try { diff --git a/src/extension/telemetry/constants.ts b/src/extension/telemetry/constants.ts index 90226a37..31f144d4 100644 --- a/src/extension/telemetry/constants.ts +++ b/src/extension/telemetry/constants.ts @@ -17,7 +17,5 @@ export enum EventName { DEBUGGER_ATTACH_TO_LOCAL_PROCESS = 'DEBUGGER.ATTACH_TO_LOCAL_PROCESS', DEBUGGER_CONFIGURATION_PROMPTS = 'DEBUGGER.CONFIGURATION.PROMPTS', DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON = 'DEBUGGER.CONFIGURATION.PROMPTS.IN.LAUNCH.JSON', - DIAGNOSTICS_MESSAGE = 'DIAGNOSTICS.MESSAGE', - DIAGNOSTICS_ACTION = 'DIAGNOSTICS.ACTION', ENVFILE_VARIABLE_SUBSTITUTION = 'ENVFILE_VARIABLE_SUBSTITUTION', } diff --git a/src/extension/telemetry/index.ts b/src/extension/telemetry/index.ts index 5bf22948..d187f89a 100644 --- a/src/extension/telemetry/index.ts +++ b/src/extension/telemetry/index.ts @@ -384,21 +384,6 @@ export interface IEventNamePropertyMapping { */ console?: ConsoleType; }; - // /** - // * Telemetry event sent when we are checking if we can handle the diagnostic code - // */ - // /* __GDPR__ - // "diagnostics.message" : { - // "code" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" } - // } - // */ - // [EventName.DIAGNOSTICS_MESSAGE]: { - // /** - // * Code of diagnostics message detected and displayed. - // * @type {string} - // */ - // code: DiagnosticCodes; - // }; /** * Telemetry captured when user code starts running after loading the debugger. */ @@ -655,39 +640,6 @@ export interface IEventNamePropertyMapping { "debugger.configuration.prompts.in.launch.json" : { "owner": "paulacamargo25" } */ [EventName.DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON]: never | undefined; - /** - * Telemetry event sent with details of actions when invoking a diagnostic command - */ - /* __GDPR__ - "diagnostics.action" : { - "commandname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }, - "ignorecode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }, - "url" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }, - "action" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" } - } - */ - [EventName.DIAGNOSTICS_ACTION]: { - /** - * Diagnostics command executed. - * @type {string} - */ - commandName?: string; - /** - * Diagnostisc code ignored (message will not be seen again). - * @type {string} - */ - ignoreCode?: string; - /** - * Url of web page launched in browser. - * @type {string} - */ - url?: string; - /** - * Custom actions performed. - * @type {'switchToCommandPrompt'} - */ - action?: 'switchToCommandPrompt'; - }; /** * Telemetry event sent when substituting Environment variables to calculate value of variables */ diff --git a/src/test/common.ts b/src/test/common.ts index 4e01d4a9..db5ba2f2 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -94,3 +94,5 @@ function getPythonPath(): string { } export interface IExtensionTestApi extends IExtensionApi {} + +export const debuggerTypeName = 'debugpy'; diff --git a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts index 8faf5770..f681ee08 100644 --- a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts +++ b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts @@ -52,7 +52,7 @@ suite('External debugpy Debugger Launcher', () => { }); suite('Path To Debugger Package', () => { - const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python'); + const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'bundled', 'libs'); test('Path to debugpy debugger package', () => { const actual = launchers.getDebugpyPackagePath(); const expected = path.join(pathToPythonLibDir, 'debugpy'); diff --git a/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test b/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts similarity index 88% rename from src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test rename to src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts index ff7ab6f9..f0e295e6 100644 --- a/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test +++ b/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts @@ -17,7 +17,10 @@ suite('Debugging - Configuration Provider File with Arguments', () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; - await buildFileWithArgsLaunchDebugConfiguration(undefined as unknown as MultiStepInput, state); + await buildFileWithArgsLaunchDebugConfiguration( + undefined as unknown as MultiStepInput, + state, + ); const config = { name: DebugConfigStrings.fileWithArgs.snippet.name, diff --git a/src/test/unittest/configuration/resolvers/attach.unit.test.ts b/src/test/unittest/configuration/resolvers/attach.unit.test.ts index 64de3555..97241da1 100644 --- a/src/test/unittest/configuration/resolvers/attach.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/attach.unit.test.ts @@ -21,6 +21,7 @@ import { AttachRequestArguments, DebugOptions } from '../../../../extension/type import { AttachConfigurationResolver } from '../../../../extension/debugger/configuration/resolvers/attach'; import * as vscodeapi from '../../../../extension/common/vscodeapi'; import * as platform from '../../../../extension/common/platform'; +import { debuggerTypeName } from '../../../common'; getInfoPerOS().forEach(([osName, osType, path]) => { if (osType === platform.OSType.Unknown) { @@ -97,7 +98,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const attach: Partial = { name: 'Python attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', }; diff --git a/src/test/unittest/configuration/resolvers/launch.unit.test.ts b/src/test/unittest/configuration/resolvers/launch.unit.test.ts index 4f52ba1e..200cccbf 100644 --- a/src/test/unittest/configuration/resolvers/launch.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/launch.unit.test.ts @@ -25,6 +25,7 @@ import { DebuggerTypeName } from '../../../../extension/constants'; import * as pythonApi from '../../../../extension/common/python'; import * as settings from '../../../../extension/common/settings'; import * as helper from '../../../../extension/debugger/configuration/resolvers/helper'; +import { debuggerTypeName } from '../../../common'; getInfoPerOS().forEach(([osName, osType, path]) => { if (osType === platform.OSType.Unknown) { @@ -107,7 +108,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const launch: LaunchRequestArguments = { name: 'Python launch', - type: 'debugpy', + type: debuggerTypeName, request: 'launch', }; @@ -153,7 +154,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(workspaceFolder, {}); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -182,7 +183,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -210,7 +211,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const filePath = Uri.file(path.dirname('')).fsPath; expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -236,7 +237,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(undefined, {}); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); @@ -261,7 +262,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const debugConfig = await resolveDebugConfiguration(undefined, {}); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -288,7 +289,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const filePath = Uri.file(defaultWorkspace).fsPath; expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'debugpy'); + expect(debugConfig).to.have.property('type', debuggerTypeName); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -705,7 +706,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); test('Test defaults of python debugger', async () => { - if (DebuggerTypeName === 'debugpy') { + if (DebuggerTypeName === debuggerTypeName) { return; } const pythonPath = `PythonPath_${new Date().toString()}`; diff --git a/src/test/unittest/extensionInit.unit.test.ts b/src/test/unittest/extensionInit.unit.test.ts index 62737df7..e1b38388 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -22,6 +22,7 @@ import { expect } from 'chai'; import { PersistentStateFactory } from '../../extension/common/persistentState'; import { DebugSessionTelemetry } from '../../extension/common/application/debugSessionTelemetry'; import { LaunchJsonCompletionProvider } from '../../extension/debugger/configuration/launch.json/completionProvider'; +import { debuggerTypeName } from '../common'; suite('Debugging - register Debugging', () => { let context: typemoq.IMock; @@ -75,10 +76,14 @@ suite('Debugging - register Debugging', () => { test('Activation will register the Debug adapter factories', async () => { registerDebugger(context.object); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'debugpy', loggingFactory); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'debugpy', debuggerPromptFactory); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'debugpy', debugSessionTelemetry); - sinon.assert.calledOnceWithMatch(registerDebugAdapterDescriptorFactoryStub, 'debugpy', descriptorFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, loggingFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, debuggerPromptFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, debugSessionTelemetry); + sinon.assert.calledOnceWithMatch( + registerDebugAdapterDescriptorFactoryStub, + debuggerTypeName, + descriptorFactory, + ); expect(registerDebugAdapterTrackerFactoryStub.callCount).to.be.equal(3); }); diff --git a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts index f2901dee..11d406d0 100644 --- a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts @@ -10,6 +10,7 @@ import { ChildProcessAttachService } from '../../../extension/debugger/hooks/chi import { DebuggerEvents } from '../../../extension/debugger/hooks/constants'; import { AttachRequestArguments } from '../../../extension/types'; import { DebuggerTypeName } from '../../../extension/constants'; +import { debuggerTypeName } from '../../common'; suite('Debug - Child Process', () => { test('Do not attach if the event is undefined', async () => { @@ -47,7 +48,7 @@ suite('Debug - Child Process', () => { const handler = new ChildProcessAttachEventHandler(instance(attachService)); const body: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', port: 1234, subProcessId: 2, diff --git a/src/test/unittest/hooks/childProcessAttachService.unit.test.ts b/src/test/unittest/hooks/childProcessAttachService.unit.test.ts index 1291057d..b01bb51c 100644 --- a/src/test/unittest/hooks/childProcessAttachService.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachService.unit.test.ts @@ -9,6 +9,7 @@ import { Uri, WorkspaceFolder, debug } from 'vscode'; import { ChildProcessAttachService } from '../../../extension/debugger/hooks/childProcessAttachService'; import { AttachRequestArguments, LaunchRequestArguments } from '../../../extension/types'; import * as vscodeapi from '../../../extension/common/vscodeapi'; +import { debuggerTypeName } from '../../common'; suite('Debug - Attach to Child Process', () => { let attachService: ChildProcessAttachService; @@ -29,7 +30,7 @@ suite('Debug - Attach to Child Process', () => { test('Message is not displayed if debugger is launched', async () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', port: 1234, subProcessId: 2, @@ -48,7 +49,7 @@ suite('Debug - Attach to Child Process', () => { test('Message is displayed if debugger is not launched', async () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', port: 1234, subProcessId: 2, @@ -72,7 +73,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', port: 1234, subProcessId: 2, @@ -96,7 +97,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: debuggerTypeName, request: 'attach', port: 1234, subProcessId: 2, @@ -116,7 +117,7 @@ suite('Debug - Attach to Child Process', () => { test('Validate debug config is passed with the correct params', async () => { const data: LaunchRequestArguments | AttachRequestArguments = { request: 'attach', - type: 'debugpy', + type: debuggerTypeName, name: 'Attach', port: 1234, subProcessId: 2, @@ -141,7 +142,7 @@ suite('Debug - Attach to Child Process', () => { }); test('Pass data as is if data is attach debug configuration', async () => { const data: AttachRequestArguments = { - type: 'debugpy', + type: debuggerTypeName, request: 'attach', name: '', }; @@ -163,7 +164,7 @@ suite('Debug - Attach to Child Process', () => { test('Validate debug config when parent/root parent was attached', async () => { const data: AttachRequestArguments = { request: 'attach', - type: 'debugpy', + type: debuggerTypeName, name: 'Attach', host: '123.123.123.123', port: 1234,