From 03876077a2d1da3277fd943c97c37f0a9547580b Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 17:19:41 -0700 Subject: [PATCH 01/14] Update package.json --- package-lock.json | 4 ++-- package.json | 52 +++++++++++++++++++++++------------------------ package.nls.json | 6 +++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf24e8a2..bda6d951 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "debugpy", + "name": "python-debugger", "version": "2023.3.0-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "debugpy", + "name": "python-debugger", "version": "2023.3.0-dev", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index b9532907..0151ffe0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "debugpy", - "displayName": "Debugpy", + "name": "python-debugger", + "displayName": "Python Debugger", "description": "Python Debugger extension using `debugpy`.", "version": "2023.3.0-dev", "publisher": "ms-python", @@ -27,8 +27,8 @@ ], "activationEvents": [ "onDebugInitialConfigurations", - "onDebugDynamicConfigurations:debugpy", - "onDebugResolve:debugpy", + "onDebugDynamicConfigurations:python-debugger", + "onDebugResolve:python-debugger", "onLanguage:python" ], "main": "./dist/extension.js", @@ -36,43 +36,43 @@ "contributes": { "commands": [ { - "category": "Debugpy", - "command": "debugpy.debugInTerminal", + "category": "Python Debugger", + "command": "python-debugger.debugInTerminal", "icon": "$(debug-alt)", - "title": "%debugpy.command.debugInTerminal.title%" + "title": "%python-debugger.command.debugInTerminal.title%" }, { - "category": "Debugpy", - "command": "debugpy.clearCacheAndReload", - "title": "%debugpy.command.clearCacheAndReload.title%" + "category": "Python Debugger", + "command": "python-debugger.clearCacheAndReload", + "title": "%python-debugger.command.clearCacheAndReload.title%" }, { - "category": "Debugpy", - "command": "debugpy.viewOutput", + "category": "Python Debugger", + "command": "python-debugger.viewOutput", "icon": { "dark": "resources/dark/repl.svg", "light": "resources/light/repl.svg" }, - "title": "%debugpy.command.viewOutput.title%" + "title": "%python-debugger.command.viewOutput.title%" } ], "menus": { "commandPalette": [ { - "category": "Debugpy", - "command": "debugpy.clearCacheAndReload", - "title": "%debugpy.command.clearCacheAndReload.title%" + "category": "Python Debugger", + "command": "python-debugger.clearCacheAndReload", + "title": "%python-debugger.command.clearCacheAndReload.title%" }, { - "category": "Debugpy", - "command": "debugpy.debugInTerminal", + "category": "Python Debugger", + "command": "python-debugger.debugInTerminal", "icon": "$(debug-alt)", - "title": "%debugpy.command.debugInTerminal.title%" + "title": "%python-debugger.command.debugInTerminal.title%" }, { - "category": "Debugpy", - "command": "debugpy.viewOutput", - "title": "%debugpy.command.viewOutput.title%" + "category": "Python Debugger", + "command": "python-debugger.viewOutput", + "title": "%python-debugger.command.viewOutput.title%" } ] }, @@ -419,14 +419,14 @@ } }, "configurationSnippets": [], - "label": "Debugpy", + "label": "Python Debugger", "languages": [ "python" ], - "type": "debugpy", + "type": "python-debugger", "variables": { - "pickProcess": "debugpy.pickLocalProcess", - "pickArgs": "debugpy.pickArgs" + "pickProcess": "python-debugger.pickLocalProcess", + "pickArgs": "python-debugger.pickArgs" }, "when": "!virtualWorkspace && shellExecutionSupported" } diff --git a/package.nls.json b/package.nls.json index 6e2822cd..a39aab4c 100644 --- a/package.nls.json +++ b/package.nls.json @@ -1,5 +1,5 @@ { - "debugpy.command.debugInTerminal.title": "Debug Python File", - "debugpy.command.clearCacheAndReload.title": "Clear Cache and Reload Window", - "debugpy.command.viewOutput.title": "Show Output" + "python-debugger.command.debugInTerminal.title": "Debug Python File", + "python-debugger.command.clearCacheAndReload.title": "Clear Cache and Reload Window", + "python-debugger.command.viewOutput.title": "Show Output" } From 3b5c0147df0ff99f3b33f001f3e3c84cd5f65a9e Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 17:19:50 -0700 Subject: [PATCH 02/14] Fix readme --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 960278fc..06cc5965 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ # Debugpy 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. +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. From 151177e367786d4c29fa4743f9a8a581ff836f42 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 17:20:24 -0700 Subject: [PATCH 03/14] update debug type name --- src/extension/common/constants.ts | 16 +++---- src/extension/common/settings.ts | 4 +- src/extension/constants.ts | 2 +- .../adapter/outdatedDebuggerPrompt.ts | 4 +- .../debugger/adapter/remoteLaunchers.ts | 2 +- .../launch.json/completionProvider.ts | 2 +- src/extension/extension.ts | 4 +- src/extension/extensionInit.ts | 2 +- src/extension/telemetry/constants.ts | 2 - src/extension/telemetry/index.ts | 48 ------------------- 10 files changed, 18 insertions(+), 68 deletions(-) diff --git a/src/extension/common/constants.ts b/src/extension/common/constants.ts index d5d621a4..31380460 100644 --- a/src/extension/common/constants.ts +++ b/src/extension/common/constants.ts @@ -29,14 +29,14 @@ export function isUnitTestExecution(): boolean { } export namespace Commands { - export const Debug_In_Terminal = 'debugpy.debugInTerminal'; - export const TriggerEnvironmentSelection = 'debugpy.triggerEnvSelection'; - export const PickLocalProcess = 'debugpy.pickLocalProcess'; - export const PickArguments = 'debugpy.pickArgs'; - export const ViewOutput = 'debugpy.viewOutput'; - export const ClearStorage = 'debugpy.clearCacheAndReload'; - export const Enable_SourceMap_Support = 'debugpy.enableSourceMapSupport'; - export const SelectDebugConfig = 'debugpy.SelectAndInsertDebugConfiguration'; + export const Debug_In_Terminal = 'python-debugger.debugInTerminal'; + export const TriggerEnvironmentSelection = 'python-debugger.triggerEnvSelection'; + export const PickLocalProcess = 'python-debugger.pickLocalProcess'; + export const PickArguments = 'python-debugger.pickArgs'; + export const ViewOutput = 'python-debugger.viewOutput'; + export const ClearStorage = 'python-debugger.clearCacheAndReload'; + export const Enable_SourceMap_Support = 'python-debugger.enableSourceMapSupport'; + export const SelectDebugConfig = 'python-debugger.SelectAndInsertDebugConfiguration'; export const Set_Interpreter = 'python.setInterpreter'; } diff --git a/src/extension/common/settings.ts b/src/extension/common/settings.ts index eed48817..119a1985 100644 --- a/src/extension/common/settings.ts +++ b/src/extension/common/settings.ts @@ -81,7 +81,7 @@ function getSettingsUriAndTarget(resource: Uri | undefined): { uri: Uri | undefi } export async function updateSetting( - section: string = 'debugpy', + section: string = 'python-debugger', setting: string, value?: unknown, resource?: Uri, @@ -92,7 +92,7 @@ export async function updateSetting( target: configTarget || ConfigurationTarget.WorkspaceFolder, }; let settingsInfo = defaultSetting; - if (section === 'debugpy' && configTarget !== ConfigurationTarget.Global) { + if (section === 'python-debugger' && configTarget !== ConfigurationTarget.Global) { settingsInfo = getSettingsUriAndTarget(resource); } diff --git a/src/extension/constants.ts b/src/extension/constants.ts index 1d06e314..b84ffe94 100644 --- a/src/extension/constants.ts +++ b/src/extension/constants.ts @@ -4,4 +4,4 @@ 'use strict'; // eslint-disable-next-line @typescript-eslint/naming-convention -export const DebuggerTypeName = 'debugpy'; +export const DebuggerTypeName = 'python-debugger'; diff --git a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts index 587783c9..a69688d4 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' && @@ -39,7 +39,7 @@ class OutdatedDebuggerPrompt implements DebugAdapterTracker { this.promptCheck.setShowPrompt(false); return true; } - if (outputMessage.body.output === 'debugpy') { + if (outputMessage.body.output === 'python-debugger') { this.promptCheck.setShowPrompt(false); } } 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/launch.json/completionProvider.ts b/src/extension/debugger/configuration/launch.json/completionProvider.ts index 15b2a67c..a18fc7bb 100644 --- a/src/extension/debugger/configuration/launch.json/completionProvider.ts +++ b/src/extension/debugger/configuration/launch.json/completionProvider.ts @@ -38,7 +38,7 @@ export class LaunchJsonCompletionProvider implements CompletionItemProvider { return [ { command: { - command: 'debugpy.SelectAndInsertDebugConfiguration', + command: 'python-debugger.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document, position, token], }, diff --git a/src/extension/extension.ts b/src/extension/extension.ts index e4b4fb55..30a03e34 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -24,8 +24,8 @@ export async function activate(context: IExtensionContext): Promise { context.subscriptions.push(outputChannel, registerLogger(outputChannel)); context.subscriptions.push(registerCommand(Commands.ViewOutput, () => outputChannel.show())); - traceLog(`Name: Debugpy`); - traceLog(`Module: debugpy`); + traceLog(`Name: Python Debugger`); + traceLog(`Module: python-debugger`); try { await registerDebugger(context); diff --git a/src/extension/extensionInit.ts b/src/extension/extensionInit.ts index 5318cd23..986d5b57 100644 --- a/src/extension/extensionInit.ts +++ b/src/extension/extensionInit.ts @@ -51,7 +51,7 @@ export async function registerDebugger(context: IExtensionContext): Promise Date: Mon, 11 Sep 2023 17:24:17 -0700 Subject: [PATCH 04/14] Fix tests --- .../launch.json/completionProvider.unit.test.ts | 2 +- .../configuration/resolvers/attach.unit.test.ts | 2 +- .../configuration/resolvers/launch.unit.test.ts | 16 ++++++++-------- src/test/unittest/extensionInit.unit.test.ts | 8 ++++---- .../hooks/childProcessAttachService.unit.test.ts | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/test/unittest/configuration/launch.json/completionProvider.unit.test.ts b/src/test/unittest/configuration/launch.json/completionProvider.unit.test.ts index 8bc97af2..8a462242 100644 --- a/src/test/unittest/configuration/launch.json/completionProvider.unit.test.ts +++ b/src/test/unittest/configuration/launch.json/completionProvider.unit.test.ts @@ -111,7 +111,7 @@ suite('Debugging - launch.json Completion Provider', () => { const expectedCompletionItem: CompletionItem = { command: { - command: 'debugpy.SelectAndInsertDebugConfiguration', + command: 'python-debugger.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document.object, position, token], }, diff --git a/src/test/unittest/configuration/resolvers/attach.unit.test.ts b/src/test/unittest/configuration/resolvers/attach.unit.test.ts index 502d6970..53d56628 100644 --- a/src/test/unittest/configuration/resolvers/attach.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/attach.unit.test.ts @@ -78,7 +78,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const attach: Partial = { name: 'Python attach', - type: 'debugpy', + type: 'python-debugger', 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 6da329c6..138516fa 100644 --- a/src/test/unittest/configuration/resolvers/launch.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/launch.unit.test.ts @@ -88,7 +88,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const launch: LaunchRequestArguments = { name: 'Python launch', - type: 'debugpy', + type: 'python-debugger', request: 'launch', }; @@ -134,7 +134,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', 'python-debugger'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -163,7 +163,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', 'python-debugger'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -191,7 +191,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', 'python-debugger'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -217,7 +217,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', 'python-debugger'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); @@ -242,7 +242,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', 'python-debugger'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -269,7 +269,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', 'python-debugger'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -686,7 +686,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); test('Test defaults of python debugger', async () => { - if (DebuggerTypeName === 'debugpy') { + if (DebuggerTypeName === 'python-debugger') { 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 f54df24b..77763fb2 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -74,10 +74,10 @@ 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, 'python-debugger', loggingFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', debuggerPromptFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', debugSessionTelemetry); + sinon.assert.calledOnceWithMatch(registerDebugAdapterDescriptorFactoryStub, 'python-debugger', descriptorFactory); expect(registerDebugAdapterTrackerFactoryStub.callCount).to.be.equal(3); }); diff --git a/src/test/unittest/hooks/childProcessAttachService.unit.test.ts b/src/test/unittest/hooks/childProcessAttachService.unit.test.ts index 1291057d..7616bf30 100644 --- a/src/test/unittest/hooks/childProcessAttachService.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachService.unit.test.ts @@ -29,7 +29,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: 'python-debugger', request: 'attach', port: 1234, subProcessId: 2, @@ -48,7 +48,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: 'python-debugger', request: 'attach', port: 1234, subProcessId: 2, @@ -72,7 +72,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: 'python-debugger', request: 'attach', port: 1234, subProcessId: 2, @@ -96,7 +96,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: 'python-debugger', request: 'attach', port: 1234, subProcessId: 2, @@ -116,7 +116,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: 'python-debugger', name: 'Attach', port: 1234, subProcessId: 2, @@ -141,7 +141,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: 'python-debugger', request: 'attach', name: '', }; @@ -163,7 +163,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: 'python-debugger', name: 'Attach', host: '123.123.123.123', port: 1234, From 7edc7be1f8c92e9e94eab4486c91598e4e078ee2 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 17:26:43 -0700 Subject: [PATCH 05/14] Fix lint --- src/test/unittest/extensionInit.unit.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/test/unittest/extensionInit.unit.test.ts b/src/test/unittest/extensionInit.unit.test.ts index 77763fb2..c3d08e4d 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -75,9 +75,21 @@ suite('Debugging - register Debugging', () => { registerDebugger(context.object); sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', loggingFactory); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', debuggerPromptFactory); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', debugSessionTelemetry); - sinon.assert.calledOnceWithMatch(registerDebugAdapterDescriptorFactoryStub, 'python-debugger', descriptorFactory); + sinon.assert.calledWithExactly( + registerDebugAdapterTrackerFactoryStub, + 'python-debugger', + debuggerPromptFactory, + ); + sinon.assert.calledWithExactly( + registerDebugAdapterTrackerFactoryStub, + 'python-debugger', + debugSessionTelemetry, + ); + sinon.assert.calledOnceWithMatch( + registerDebugAdapterDescriptorFactoryStub, + 'python-debugger', + descriptorFactory, + ); expect(registerDebugAdapterTrackerFactoryStub.callCount).to.be.equal(3); }); From 951d21aa32f1b89c5d039b2ee9467027d6d60128 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 17:36:50 -0700 Subject: [PATCH 06/14] Fix test --- src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts index f2901dee..0c4e3a23 100644 --- a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts @@ -47,7 +47,7 @@ suite('Debug - Child Process', () => { const handler = new ChildProcessAttachEventHandler(instance(attachService)); const body: AttachRequestArguments = { name: 'Attach', - type: 'debugpy', + type: 'python-debugger', request: 'attach', port: 1234, subProcessId: 2, From d880de9f894825aa3887b0399f08476fe947a5d9 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 11 Sep 2023 18:41:02 -0700 Subject: [PATCH 07/14] Update translations --- README.md | 4 ++-- src/extension/api.ts | 6 ++--- src/extension/common/utils/localize.ts | 24 +++++++++---------- .../debugger/adapter/remoteLaunchers.ts | 4 ++-- .../dynamicdebugConfigurationService.ts | 8 +++---- src/extension/extension.ts | 2 +- .../adapter/remoteLaunchers.unit.test.ts | 6 ++--- src/test/unittest/utils.ts | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 06cc5965..e508bef6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 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. 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. @@ -10,7 +10,7 @@ Note: Once installed in Visual Studio Code, python-debugger will be automatically activated when you open a Python file. -## Disabling the Debugpy extension +## 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 diff --git a/src/extension/api.ts b/src/extension/api.ts index acc4164e..7fcc2c9a 100644 --- a/src/extension/api.ts +++ b/src/extension/api.ts @@ -4,7 +4,7 @@ 'use strict'; import { IExtensionApi } from './apiTypes'; -import { getDebugpyLauncherArgs, getDebugpyPackagePath } from './debugger/adapter/remoteLaunchers'; +import { getPythonDebuggerLauncherArgs, getPythonDebuggerPackagePath } from './debugger/adapter/remoteLaunchers'; export function buildApi(): IExtensionApi { const api: IExtensionApi = { @@ -14,14 +14,14 @@ export function buildApi(): IExtensionApi { port: number, waitUntilDebuggerAttaches: boolean = true, ): Promise { - return getDebugpyLauncherArgs({ + return getPythonDebuggerLauncherArgs({ host, port, waitUntilDebuggerAttaches, }); }, async getDebuggerPackagePath(): Promise { - return getDebugpyPackagePath(); + return getPythonDebuggerPackagePath(); }, }, }; 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/remoteLaunchers.ts b/src/extension/debugger/adapter/remoteLaunchers.ts index 2757b092..99209d31 100644 --- a/src/extension/debugger/adapter/remoteLaunchers.ts +++ b/src/extension/debugger/adapter/remoteLaunchers.ts @@ -17,7 +17,7 @@ type RemoteDebugOptions = { waitUntilDebuggerAttaches: boolean; }; -export function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath: string = pathToDebugger) { +export function getPythonDebuggerLauncherArgs(options: RemoteDebugOptions, debuggerPath: string = pathToDebugger) { const waitArgs = options.waitUntilDebuggerAttaches ? ['--wait-for-client'] : []; return [ fileToCommandArgumentForPythonExt(debuggerPath), @@ -27,6 +27,6 @@ export function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath ]; } -export function getDebugpyPackagePath(): string { +export function getPythonDebuggerPackagePath(): string { return pathToDebugger; } 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 30a03e34..a576e110 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -20,7 +20,7 @@ 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())); diff --git a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts index 8faf5770..042bff6c 100644 --- a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts +++ b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts @@ -24,7 +24,7 @@ suite('External debugpy Debugger Launcher', () => { ].forEach((testParams) => { suite(testParams.testName, async () => { test('Test remote debug launcher args (and do not wait for debugger to attach)', async () => { - const args = launchers.getDebugpyLauncherArgs( + const args = launchers.getPythonDebuggerLauncherArgs( { host: 'something', port: 1234, @@ -36,7 +36,7 @@ suite('External debugpy Debugger Launcher', () => { expect(args).to.be.deep.equal(expectedArgs); }); test('Test remote debug launcher args (and wait for debugger to attach)', async () => { - const args = launchers.getDebugpyLauncherArgs( + const args = launchers.getPythonDebuggerLauncherArgs( { host: 'something', port: 1234, @@ -54,7 +54,7 @@ suite('External debugpy Debugger Launcher', () => { suite('Path To Debugger Package', () => { const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python'); test('Path to debugpy debugger package', () => { - const actual = launchers.getDebugpyPackagePath(); + const actual = launchers.getPythonDebuggerPackagePath(); const expected = path.join(pathToPythonLibDir, 'debugpy'); expect(actual).to.be.deep.equal(expected); }); diff --git a/src/test/unittest/utils.ts b/src/test/unittest/utils.ts index 858982ac..87a70757 100644 --- a/src/test/unittest/utils.ts +++ b/src/test/unittest/utils.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { DebugProtocol } from 'vscode-debugprotocol'; import { EXTENSION_ROOT_DIR } from '../../extension/common/constants'; -import { getDebugpyLauncherArgs } from '../../extension/debugger/adapter/remoteLaunchers'; +import { getPythonDebuggerLauncherArgs } from '../../extension/debugger/adapter/remoteLaunchers'; import { sleep } from '../core'; import { PythonFixture } from '../fixtures'; import { Proc, ProcOutput, ProcResult } from '../proc'; @@ -353,7 +353,7 @@ export class DebuggerFixture extends PythonFixture { } public runDebugger(port: number, filename: string, ...scriptArgs: string[]) { - const args = getDebugpyLauncherArgs({ + const args = getPythonDebuggerLauncherArgs({ host: 'localhost', port: port, // This causes problems if we set it to true. From e5a791bb7e81a1265aae45a256cb6303c465dccc Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 14:02:03 -0700 Subject: [PATCH 08/14] revert extension id --- package-lock.json | 4 ++-- package.json | 36 ++++++++++++++++++------------------ src/extension/constants.ts | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index bda6d951..bf24e8a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "python-debugger", + "name": "debugpy", "version": "2023.3.0-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "python-debugger", + "name": "debugpy", "version": "2023.3.0-dev", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0151ffe0..cc4b0e7d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "python-debugger", + "name": "debugpy", "displayName": "Python Debugger", "description": "Python Debugger extension using `debugpy`.", "version": "2023.3.0-dev", @@ -27,8 +27,8 @@ ], "activationEvents": [ "onDebugInitialConfigurations", - "onDebugDynamicConfigurations:python-debugger", - "onDebugResolve:python-debugger", + "onDebugDynamicConfigurations:debugpy", + "onDebugResolve:debugpy", "onLanguage:python" ], "main": "./dist/extension.js", @@ -37,42 +37,42 @@ "commands": [ { "category": "Python Debugger", - "command": "python-debugger.debugInTerminal", + "command": "debugpy.debugInTerminal", "icon": "$(debug-alt)", - "title": "%python-debugger.command.debugInTerminal.title%" + "title": "%debugpy.command.debugInTerminal.title%" }, { "category": "Python Debugger", - "command": "python-debugger.clearCacheAndReload", - "title": "%python-debugger.command.clearCacheAndReload.title%" + "command": "debugpy.clearCacheAndReload", + "title": "%debugpy.command.clearCacheAndReload.title%" }, { "category": "Python Debugger", - "command": "python-debugger.viewOutput", + "command": "debugpy.viewOutput", "icon": { "dark": "resources/dark/repl.svg", "light": "resources/light/repl.svg" }, - "title": "%python-debugger.command.viewOutput.title%" + "title": "%debugpy.command.viewOutput.title%" } ], "menus": { "commandPalette": [ { "category": "Python Debugger", - "command": "python-debugger.clearCacheAndReload", - "title": "%python-debugger.command.clearCacheAndReload.title%" + "command": "debugpy.clearCacheAndReload", + "title": "%debugpy.command.clearCacheAndReload.title%" }, { "category": "Python Debugger", - "command": "python-debugger.debugInTerminal", + "command": "debugpy.debugInTerminal", "icon": "$(debug-alt)", - "title": "%python-debugger.command.debugInTerminal.title%" + "title": "%debugpy.command.debugInTerminal.title%" }, { "category": "Python Debugger", - "command": "python-debugger.viewOutput", - "title": "%python-debugger.command.viewOutput.title%" + "command": "debugpy.viewOutput", + "title": "%debugpy.command.viewOutput.title%" } ] }, @@ -423,10 +423,10 @@ "languages": [ "python" ], - "type": "python-debugger", + "type": "debugpy", "variables": { - "pickProcess": "python-debugger.pickLocalProcess", - "pickArgs": "python-debugger.pickArgs" + "pickProcess": "debugpy.pickLocalProcess", + "pickArgs": "debugpy.pickArgs" }, "when": "!virtualWorkspace && shellExecutionSupported" } diff --git a/src/extension/constants.ts b/src/extension/constants.ts index b84ffe94..1d06e314 100644 --- a/src/extension/constants.ts +++ b/src/extension/constants.ts @@ -4,4 +4,4 @@ 'use strict'; // eslint-disable-next-line @typescript-eslint/naming-convention -export const DebuggerTypeName = 'python-debugger'; +export const DebuggerTypeName = 'debugpy'; From aa5086a90f1463b816162689b783a3b91ea493c0 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 14:02:09 -0700 Subject: [PATCH 09/14] Fix tests --- src/test/unittest/adapter/factory.unit.test.ts | 2 +- .../adapter/remoteLaunchers.unit.test.ts | 2 +- .../configuration/resolvers/attach.unit.test.ts | 2 +- .../configuration/resolvers/launch.unit.test.ts | 16 ++++++++-------- src/test/unittest/extensionInit.unit.test.ts | 8 ++++---- .../hooks/childProcessAttachHandler.unit.test.ts | 2 +- .../hooks/childProcessAttachService.unit.test.ts | 14 +++++++------- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/test/unittest/adapter/factory.unit.test.ts b/src/test/unittest/adapter/factory.unit.test.ts index 04fef451..5cd492c3 100644 --- a/src/test/unittest/adapter/factory.unit.test.ts +++ b/src/test/unittest/adapter/factory.unit.test.ts @@ -126,7 +126,7 @@ suite('Debugging - Adapter Factory', () => { assert.deepStrictEqual(descriptor, debugExecutable); }); - test.only('Display a message if no python interpreter is set', async () => { + test('Display a message if no python interpreter is set', async () => { getActiveEnvironmentPathStub.resolves(undefined); const session = createSession({}); const promise = factory.createDebugAdapterDescriptor(session, nodeExecutable); diff --git a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts index 042bff6c..3f324589 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.getPythonDebuggerPackagePath(); const expected = path.join(pathToPythonLibDir, 'debugpy'); diff --git a/src/test/unittest/configuration/resolvers/attach.unit.test.ts b/src/test/unittest/configuration/resolvers/attach.unit.test.ts index 53d56628..502d6970 100644 --- a/src/test/unittest/configuration/resolvers/attach.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/attach.unit.test.ts @@ -78,7 +78,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const attach: Partial = { name: 'Python attach', - type: 'python-debugger', + type: 'debugpy', 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 138516fa..6da329c6 100644 --- a/src/test/unittest/configuration/resolvers/launch.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/launch.unit.test.ts @@ -88,7 +88,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const launch: LaunchRequestArguments = { name: 'Python launch', - type: 'python-debugger', + type: 'debugpy', request: 'launch', }; @@ -134,7 +134,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', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -163,7 +163,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); - expect(debugConfig).to.have.property('type', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -191,7 +191,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', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -217,7 +217,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', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); @@ -242,7 +242,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', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -269,7 +269,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', 'python-debugger'); + expect(debugConfig).to.have.property('type', 'debugpy'); expect(debugConfig).to.have.property('request', 'launch'); expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); @@ -686,7 +686,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); test('Test defaults of python debugger', async () => { - if (DebuggerTypeName === 'python-debugger') { + if (DebuggerTypeName === 'debugpy') { 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 c3d08e4d..a502431e 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -74,20 +74,20 @@ suite('Debugging - register Debugging', () => { test('Activation will register the Debug adapter factories', async () => { registerDebugger(context.object); - sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'python-debugger', loggingFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'debugpy', loggingFactory); sinon.assert.calledWithExactly( registerDebugAdapterTrackerFactoryStub, - 'python-debugger', + 'debugpy', debuggerPromptFactory, ); sinon.assert.calledWithExactly( registerDebugAdapterTrackerFactoryStub, - 'python-debugger', + 'debugpy', debugSessionTelemetry, ); sinon.assert.calledOnceWithMatch( registerDebugAdapterDescriptorFactoryStub, - 'python-debugger', + 'debugpy', descriptorFactory, ); diff --git a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts index 0c4e3a23..f2901dee 100644 --- a/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachHandler.unit.test.ts @@ -47,7 +47,7 @@ suite('Debug - Child Process', () => { const handler = new ChildProcessAttachEventHandler(instance(attachService)); const body: AttachRequestArguments = { name: 'Attach', - type: 'python-debugger', + type: 'debugpy', 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 7616bf30..1291057d 100644 --- a/src/test/unittest/hooks/childProcessAttachService.unit.test.ts +++ b/src/test/unittest/hooks/childProcessAttachService.unit.test.ts @@ -29,7 +29,7 @@ suite('Debug - Attach to Child Process', () => { test('Message is not displayed if debugger is launched', async () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'python-debugger', + type: 'debugpy', request: 'attach', port: 1234, subProcessId: 2, @@ -48,7 +48,7 @@ suite('Debug - Attach to Child Process', () => { test('Message is displayed if debugger is not launched', async () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'python-debugger', + type: 'debugpy', request: 'attach', port: 1234, subProcessId: 2, @@ -72,7 +72,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'python-debugger', + type: 'debugpy', request: 'attach', port: 1234, subProcessId: 2, @@ -96,7 +96,7 @@ suite('Debug - Attach to Child Process', () => { const data: AttachRequestArguments = { name: 'Attach', - type: 'python-debugger', + type: 'debugpy', request: 'attach', port: 1234, subProcessId: 2, @@ -116,7 +116,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: 'python-debugger', + type: 'debugpy', name: 'Attach', port: 1234, subProcessId: 2, @@ -141,7 +141,7 @@ suite('Debug - Attach to Child Process', () => { }); test('Pass data as is if data is attach debug configuration', async () => { const data: AttachRequestArguments = { - type: 'python-debugger', + type: 'debugpy', request: 'attach', name: '', }; @@ -163,7 +163,7 @@ suite('Debug - Attach to Child Process', () => { test('Validate debug config when parent/root parent was attached', async () => { const data: AttachRequestArguments = { request: 'attach', - type: 'python-debugger', + type: 'debugpy', name: 'Attach', host: '123.123.123.123', port: 1234, From 69030f30ab5f63ab4b4d47a424aecc9e2c580882 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 14:02:37 -0700 Subject: [PATCH 10/14] fix lint --- src/test/unittest/extensionInit.unit.test.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/test/unittest/extensionInit.unit.test.ts b/src/test/unittest/extensionInit.unit.test.ts index a502431e..f54df24b 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -75,21 +75,9 @@ suite('Debugging - register Debugging', () => { 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, 'debugpy', debuggerPromptFactory); + sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, 'debugpy', debugSessionTelemetry); + sinon.assert.calledOnceWithMatch(registerDebugAdapterDescriptorFactoryStub, 'debugpy', descriptorFactory); expect(registerDebugAdapterTrackerFactoryStub.callCount).to.be.equal(3); }); From c9da99061b59f05185086c21736356ea0aaaf3d8 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 15:51:22 -0700 Subject: [PATCH 11/14] Update debug type name --- src/extension/constants.ts | 2 +- src/test/common.ts | 4 +++- .../configuration/resolvers/attach.unit.test.ts | 3 ++- .../configuration/resolvers/launch.unit.test.ts | 17 +++++++++-------- src/test/unittest/extensionInit.unit.test.ts | 9 +++++---- .../childProcessAttachHandler.unit.test.ts | 3 ++- .../childProcessAttachService.unit.test.ts | 15 ++++++++------- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/extension/constants.ts b/src/extension/constants.ts index 1d06e314..b84ffe94 100644 --- a/src/extension/constants.ts +++ b/src/extension/constants.ts @@ -4,4 +4,4 @@ 'use strict'; // eslint-disable-next-line @typescript-eslint/naming-convention -export const DebuggerTypeName = 'debugpy'; +export const DebuggerTypeName = 'python-debugger'; diff --git a/src/test/common.ts b/src/test/common.ts index 4e01d4a9..cf2d1747 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -93,4 +93,6 @@ function getPythonPath(): string { return 'python'; } -export interface IExtensionTestApi extends IExtensionApi {} +export interface IExtensionTestApi extends IExtensionApi {}; + +export const debuggerTypeName = "python-debugger"; diff --git a/src/test/unittest/configuration/resolvers/attach.unit.test.ts b/src/test/unittest/configuration/resolvers/attach.unit.test.ts index 502d6970..33ae4d85 100644 --- a/src/test/unittest/configuration/resolvers/attach.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/attach.unit.test.ts @@ -13,6 +13,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) { @@ -78,7 +79,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 6da329c6..5835f228 100644 --- a/src/test/unittest/configuration/resolvers/launch.unit.test.ts +++ b/src/test/unittest/configuration/resolvers/launch.unit.test.ts @@ -17,6 +17,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) { @@ -88,7 +89,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const launch: LaunchRequestArguments = { name: 'Python launch', - type: 'debugpy', + type: debuggerTypeName, request: 'launch', }; @@ -134,7 +135,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'); @@ -163,7 +164,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'); @@ -191,7 +192,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'); @@ -217,7 +218,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); @@ -242,7 +243,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'); @@ -269,7 +270,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'); @@ -686,7 +687,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 f54df24b..ee0ec279 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; @@ -74,10 +75,10 @@ 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, From fafae52c8a961f1471028f00f45eb09c6dd832f8 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 17:05:35 -0700 Subject: [PATCH 12/14] Fix translations and lint --- package.json | 2 +- package.nls.json | 6 +++--- src/extension/api.ts | 6 +++--- src/extension/common/constants.ts | 16 ++++++++-------- src/extension/common/settings.ts | 4 ++-- .../debugger/adapter/outdatedDebuggerPrompt.ts | 2 +- .../debugger/adapter/remoteLaunchers.ts | 4 ++-- .../launch.json/completionProvider.ts | 2 +- src/extension/extension.ts | 2 +- src/test/common.ts | 4 ++-- .../adapter/remoteLaunchers.unit.test.ts | 6 +++--- src/test/unittest/extensionInit.unit.test.ts | 6 +++++- src/test/unittest/utils.ts | 4 ++-- 13 files changed, 34 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index cc4b0e7d..52a0032f 100644 --- a/package.json +++ b/package.json @@ -423,7 +423,7 @@ "languages": [ "python" ], - "type": "debugpy", + "type": "python-debugger", "variables": { "pickProcess": "debugpy.pickLocalProcess", "pickArgs": "debugpy.pickArgs" diff --git a/package.nls.json b/package.nls.json index a39aab4c..6e2822cd 100644 --- a/package.nls.json +++ b/package.nls.json @@ -1,5 +1,5 @@ { - "python-debugger.command.debugInTerminal.title": "Debug Python File", - "python-debugger.command.clearCacheAndReload.title": "Clear Cache and Reload Window", - "python-debugger.command.viewOutput.title": "Show Output" + "debugpy.command.debugInTerminal.title": "Debug Python File", + "debugpy.command.clearCacheAndReload.title": "Clear Cache and Reload Window", + "debugpy.command.viewOutput.title": "Show Output" } diff --git a/src/extension/api.ts b/src/extension/api.ts index 7fcc2c9a..acc4164e 100644 --- a/src/extension/api.ts +++ b/src/extension/api.ts @@ -4,7 +4,7 @@ 'use strict'; import { IExtensionApi } from './apiTypes'; -import { getPythonDebuggerLauncherArgs, getPythonDebuggerPackagePath } from './debugger/adapter/remoteLaunchers'; +import { getDebugpyLauncherArgs, getDebugpyPackagePath } from './debugger/adapter/remoteLaunchers'; export function buildApi(): IExtensionApi { const api: IExtensionApi = { @@ -14,14 +14,14 @@ export function buildApi(): IExtensionApi { port: number, waitUntilDebuggerAttaches: boolean = true, ): Promise { - return getPythonDebuggerLauncherArgs({ + return getDebugpyLauncherArgs({ host, port, waitUntilDebuggerAttaches, }); }, async getDebuggerPackagePath(): Promise { - return getPythonDebuggerPackagePath(); + return getDebugpyPackagePath(); }, }, }; diff --git a/src/extension/common/constants.ts b/src/extension/common/constants.ts index 31380460..d5d621a4 100644 --- a/src/extension/common/constants.ts +++ b/src/extension/common/constants.ts @@ -29,14 +29,14 @@ export function isUnitTestExecution(): boolean { } export namespace Commands { - export const Debug_In_Terminal = 'python-debugger.debugInTerminal'; - export const TriggerEnvironmentSelection = 'python-debugger.triggerEnvSelection'; - export const PickLocalProcess = 'python-debugger.pickLocalProcess'; - export const PickArguments = 'python-debugger.pickArgs'; - export const ViewOutput = 'python-debugger.viewOutput'; - export const ClearStorage = 'python-debugger.clearCacheAndReload'; - export const Enable_SourceMap_Support = 'python-debugger.enableSourceMapSupport'; - export const SelectDebugConfig = 'python-debugger.SelectAndInsertDebugConfiguration'; + export const Debug_In_Terminal = 'debugpy.debugInTerminal'; + export const TriggerEnvironmentSelection = 'debugpy.triggerEnvSelection'; + export const PickLocalProcess = 'debugpy.pickLocalProcess'; + export const PickArguments = 'debugpy.pickArgs'; + export const ViewOutput = 'debugpy.viewOutput'; + export const ClearStorage = 'debugpy.clearCacheAndReload'; + export const Enable_SourceMap_Support = 'debugpy.enableSourceMapSupport'; + export const SelectDebugConfig = 'debugpy.SelectAndInsertDebugConfiguration'; export const Set_Interpreter = 'python.setInterpreter'; } diff --git a/src/extension/common/settings.ts b/src/extension/common/settings.ts index 119a1985..eed48817 100644 --- a/src/extension/common/settings.ts +++ b/src/extension/common/settings.ts @@ -81,7 +81,7 @@ function getSettingsUriAndTarget(resource: Uri | undefined): { uri: Uri | undefi } export async function updateSetting( - section: string = 'python-debugger', + section: string = 'debugpy', setting: string, value?: unknown, resource?: Uri, @@ -92,7 +92,7 @@ export async function updateSetting( target: configTarget || ConfigurationTarget.WorkspaceFolder, }; let settingsInfo = defaultSetting; - if (section === 'python-debugger' && configTarget !== ConfigurationTarget.Global) { + if (section === 'debugpy' && configTarget !== ConfigurationTarget.Global) { settingsInfo = getSettingsUriAndTarget(resource); } diff --git a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts index a69688d4..4bcba4f3 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') { - // python-debugger 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 99209d31..2757b092 100644 --- a/src/extension/debugger/adapter/remoteLaunchers.ts +++ b/src/extension/debugger/adapter/remoteLaunchers.ts @@ -17,7 +17,7 @@ type RemoteDebugOptions = { waitUntilDebuggerAttaches: boolean; }; -export function getPythonDebuggerLauncherArgs(options: RemoteDebugOptions, debuggerPath: string = pathToDebugger) { +export function getDebugpyLauncherArgs(options: RemoteDebugOptions, debuggerPath: string = pathToDebugger) { const waitArgs = options.waitUntilDebuggerAttaches ? ['--wait-for-client'] : []; return [ fileToCommandArgumentForPythonExt(debuggerPath), @@ -27,6 +27,6 @@ export function getPythonDebuggerLauncherArgs(options: RemoteDebugOptions, debug ]; } -export function getPythonDebuggerPackagePath(): string { +export function getDebugpyPackagePath(): string { return pathToDebugger; } diff --git a/src/extension/debugger/configuration/launch.json/completionProvider.ts b/src/extension/debugger/configuration/launch.json/completionProvider.ts index a18fc7bb..15b2a67c 100644 --- a/src/extension/debugger/configuration/launch.json/completionProvider.ts +++ b/src/extension/debugger/configuration/launch.json/completionProvider.ts @@ -38,7 +38,7 @@ export class LaunchJsonCompletionProvider implements CompletionItemProvider { return [ { command: { - command: 'python-debugger.SelectAndInsertDebugConfiguration', + command: 'debugpy.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document, position, token], }, diff --git a/src/extension/extension.ts b/src/extension/extension.ts index a576e110..1829bc61 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -25,7 +25,7 @@ export async function activate(context: IExtensionContext): Promise { context.subscriptions.push(registerCommand(Commands.ViewOutput, () => outputChannel.show())); traceLog(`Name: Python Debugger`); - traceLog(`Module: python-debugger`); + traceLog(`Module: debugpy`); try { await registerDebugger(context); diff --git a/src/test/common.ts b/src/test/common.ts index cf2d1747..01b81295 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -93,6 +93,6 @@ function getPythonPath(): string { return 'python'; } -export interface IExtensionTestApi extends IExtensionApi {}; +export interface IExtensionTestApi extends IExtensionApi {} -export const debuggerTypeName = "python-debugger"; +export const debuggerTypeName = 'python-debugger'; diff --git a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts index 3f324589..f681ee08 100644 --- a/src/test/unittest/adapter/remoteLaunchers.unit.test.ts +++ b/src/test/unittest/adapter/remoteLaunchers.unit.test.ts @@ -24,7 +24,7 @@ suite('External debugpy Debugger Launcher', () => { ].forEach((testParams) => { suite(testParams.testName, async () => { test('Test remote debug launcher args (and do not wait for debugger to attach)', async () => { - const args = launchers.getPythonDebuggerLauncherArgs( + const args = launchers.getDebugpyLauncherArgs( { host: 'something', port: 1234, @@ -36,7 +36,7 @@ suite('External debugpy Debugger Launcher', () => { expect(args).to.be.deep.equal(expectedArgs); }); test('Test remote debug launcher args (and wait for debugger to attach)', async () => { - const args = launchers.getPythonDebuggerLauncherArgs( + const args = launchers.getDebugpyLauncherArgs( { host: 'something', port: 1234, @@ -54,7 +54,7 @@ suite('External debugpy Debugger Launcher', () => { suite('Path To Debugger Package', () => { const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'bundled', 'libs'); test('Path to debugpy debugger package', () => { - const actual = launchers.getPythonDebuggerPackagePath(); + const actual = launchers.getDebugpyPackagePath(); const expected = path.join(pathToPythonLibDir, 'debugpy'); expect(actual).to.be.deep.equal(expected); }); diff --git a/src/test/unittest/extensionInit.unit.test.ts b/src/test/unittest/extensionInit.unit.test.ts index ee0ec279..b884c155 100644 --- a/src/test/unittest/extensionInit.unit.test.ts +++ b/src/test/unittest/extensionInit.unit.test.ts @@ -78,7 +78,11 @@ suite('Debugging - register Debugging', () => { sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, loggingFactory); sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, debuggerPromptFactory); sinon.assert.calledWithExactly(registerDebugAdapterTrackerFactoryStub, debuggerTypeName, debugSessionTelemetry); - sinon.assert.calledOnceWithMatch(registerDebugAdapterDescriptorFactoryStub, debuggerTypeName, descriptorFactory); + sinon.assert.calledOnceWithMatch( + registerDebugAdapterDescriptorFactoryStub, + debuggerTypeName, + descriptorFactory, + ); expect(registerDebugAdapterTrackerFactoryStub.callCount).to.be.equal(3); }); diff --git a/src/test/unittest/utils.ts b/src/test/unittest/utils.ts index 87a70757..858982ac 100644 --- a/src/test/unittest/utils.ts +++ b/src/test/unittest/utils.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import * as vscode from 'vscode'; import { DebugProtocol } from 'vscode-debugprotocol'; import { EXTENSION_ROOT_DIR } from '../../extension/common/constants'; -import { getPythonDebuggerLauncherArgs } from '../../extension/debugger/adapter/remoteLaunchers'; +import { getDebugpyLauncherArgs } from '../../extension/debugger/adapter/remoteLaunchers'; import { sleep } from '../core'; import { PythonFixture } from '../fixtures'; import { Proc, ProcOutput, ProcResult } from '../proc'; @@ -353,7 +353,7 @@ export class DebuggerFixture extends PythonFixture { } public runDebugger(port: number, filename: string, ...scriptArgs: string[]) { - const args = getPythonDebuggerLauncherArgs({ + const args = getDebugpyLauncherArgs({ host: 'localhost', port: port, // This causes problems if we set it to true. From 88d4073361168b994edbe05a6645b145890daba6 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 17:32:28 -0700 Subject: [PATCH 13/14] update debug type --- README.md | 2 +- package.json | 2 +- src/extension/constants.ts | 2 +- src/extension/debugger/adapter/outdatedDebuggerPrompt.ts | 2 +- src/extension/extensionInit.ts | 2 +- src/test/common.ts | 2 +- .../configuration/launch.json/completionProvider.unit.test.ts | 2 +- ...LaunchWithArgs.unit.test => fileLaunchWithArgs.unit.test.ts} | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename src/test/unittest/configuration/providers/{fileLaunchWithArgs.unit.test => fileLaunchWithArgs.unit.test.ts} (100%) diff --git a/README.md b/README.md index e508bef6..c4555200 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you want to disable the Python Debugger extension, you can [disable this exte | Command | Description | | ---------------------- | --------------------------------- | -| Python Debugger: viewOutput | Show the python-debugger extension output. | +| 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. | diff --git a/package.json b/package.json index 52a0032f..cc4b0e7d 100644 --- a/package.json +++ b/package.json @@ -423,7 +423,7 @@ "languages": [ "python" ], - "type": "python-debugger", + "type": "debugpy", "variables": { "pickProcess": "debugpy.pickLocalProcess", "pickArgs": "debugpy.pickArgs" diff --git a/src/extension/constants.ts b/src/extension/constants.ts index b84ffe94..1d06e314 100644 --- a/src/extension/constants.ts +++ b/src/extension/constants.ts @@ -4,4 +4,4 @@ 'use strict'; // eslint-disable-next-line @typescript-eslint/naming-convention -export const DebuggerTypeName = 'python-debugger'; +export const DebuggerTypeName = 'debugpy'; diff --git a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts index 4bcba4f3..29aac508 100644 --- a/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts +++ b/src/extension/debugger/adapter/outdatedDebuggerPrompt.ts @@ -39,7 +39,7 @@ class OutdatedDebuggerPrompt implements DebugAdapterTracker { this.promptCheck.setShowPrompt(false); return true; } - if (outputMessage.body.output === 'python-debugger') { + if (outputMessage.body.output === 'debugpy') { this.promptCheck.setShowPrompt(false); } } diff --git a/src/extension/extensionInit.ts b/src/extension/extensionInit.ts index 986d5b57..5318cd23 100644 --- a/src/extension/extensionInit.ts +++ b/src/extension/extensionInit.ts @@ -51,7 +51,7 @@ export async function registerDebugger(context: IExtensionContext): Promise { const expectedCompletionItem: CompletionItem = { command: { - command: 'python-debugger.SelectAndInsertDebugConfiguration', + command: 'debugpy.SelectAndInsertDebugConfiguration', title: DebugConfigStrings.launchJsonCompletions.description, arguments: [document.object, position, token], }, diff --git a/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test b/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts similarity index 100% rename from src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test rename to src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts From 2cc5a605552c71997e817352e2b753b869289331 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Wed, 13 Sep 2023 17:34:54 -0700 Subject: [PATCH 14/14] fix lint --- .../configuration/providers/fileLaunchWithArgs.unit.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts b/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts index ff7ab6f9..f0e295e6 100644 --- a/src/test/unittest/configuration/providers/fileLaunchWithArgs.unit.test.ts +++ 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,