Skip to content

Commit 9a00d0c

Browse files
committedMay 2, 2024
feat(vscode): get debugpy debuggerpackagepath from ms-python.debugpy extension
closes #224
1 parent c2294bf commit 9a00d0c

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed
 

Diff for: ‎vscode-client/debugmanager.ts

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ class RobotCodeDebugConfigurationProvider implements vscode.DebugConfigurationPr
192192
...(envPythonPath ? envPythonPath.split(path.delimiter) : []),
193193
].join(path.delimiter);
194194
debugConfiguration.env = env;
195+
} else {
196+
this.pythonManager.outputChannel.appendLine(
197+
"WARNING: Failed to get debugpy path from extension. You need to manually install the debugpy package in your python environment.",
198+
);
195199
}
196200
}
197201
} else if (debugConfiguration.request === "attach") {

Diff for: ‎vscode-client/pythonmanger.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ export class PythonManager {
141141

142142
public async getDebuggerPackagePath(): Promise<string | undefined> {
143143
// TODO: this is not enabled in debugpy extension yet
144-
// const debugpy = vscode.extensions.getExtension("ms-python.debugpy");
145-
// if (debugpy !== undefined) {
146-
// if (!debugpy.isActive) {
147-
// await debugpy.activate();
148-
// }
149-
// const path = (debugpy.exports as PythonExtension)?.debug.getDebuggerPackagePath();
150-
// if (path !== undefined) {
151-
// return path;
152-
// }
153-
// }
144+
const debugpy = vscode.extensions.getExtension("ms-python.debugpy");
145+
if (debugpy !== undefined) {
146+
if (!debugpy.isActive) {
147+
await debugpy.activate();
148+
}
149+
const path = (debugpy.exports as PythonExtension)?.debug.getDebuggerPackagePath();
150+
if (path !== undefined) {
151+
return path;
152+
}
153+
}
154154
return (await this.getPythonExtension())?.debug.getDebuggerPackagePath();
155155
}
156156

0 commit comments

Comments
 (0)