-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DA and ptvsd experiments support to remote debugging API #7570
Add DA and ptvsd experiments support to remote debugging API #7570
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7570 +/- ##
==========================================
- Coverage 58.88% 58.23% -0.66%
==========================================
Files 492 492
Lines 21851 21521 -330
Branches 3503 3505 +2
==========================================
- Hits 12868 12533 -335
- Misses 8182 8186 +4
- Partials 801 802 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM. I've left some formatting-related comments (appropriately marked) that you can do with as you will. I also provided some points to consider regarding getRemoteLauncherCommand()
. FWIW, the logic seems fine. The only real concern I have is that DebugAdapterDescriptorFactory.getPtvsdPath()
is returning the wrong thing.
src/client/api.ts
Outdated
async getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches: boolean = true): Promise<string[]> { | ||
const pythonSettings = configuration.getSettings(); | ||
|
||
if (experimentsManager.inExperiment(DebugAdapterExperiment.experiment) && (await debugFactory.useNewPtvsd(pythonSettings.pythonPath))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, the await debugFactory.useNewPtvsd(pythonSettings.pythonPath))
case is for when a user is using their own ptvsd. If that's the case then won't that case still apply after the experiment is over? We would be stuck still depending on the old debug adapter code (e.g. RemoteDebuggerExternalLauncherScriptProvider
).
So this is probably the best opportunity to address that. Do that by folding RemoteDebuggerExternalLauncherScriptProvider
into getRemoteLauncherCommand()
here or into DebugAdapterDescriptorFactory.getPtvsdPath()
.
I suppose we could also punt on it (open a new issue). :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, the key question is whether or not the user gets a version of ptvsd that has the new debug adapter. Really the key question is which "script" to use. So it may make more sense to have DebugAdapterDescriptorFactory.getPtvsdPath()
deal with the cases. Then DebugAdapterDescriptorFactory.useNewPtvsd()
would be unnecessary. That would mean getRemoteLauncherCommand()
would look more like this:
async getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches: boolean = true): Promise<string[]> {
const script = await debugFactory.getPtvsdPath(pythonSettings.pythonPath);
const waitArgs = waitUntilDebuggerAttaches ? ['--wait'] : [];
return [
script.fileToCommandArgument(),
'--default',
'--host', host,
'--port', port.toString(),
...waitArgs
];
}
DebugAdapterDescriptorFactory.getPtvsdPath()
would have to deal with the 3 cases (new debug adapter, old debug adapter with our distributed ptvsd, user-installed ptvsd).
FWIW, I'm also not a fan of how ptvsd-specific details are sitting in this module. They should be with the other debugger stuff. The above helps address that a little. I'd expect a better solution to involve adding something like DebugAdapterDescriptorFactory.getPTVSDArgv()
. We can look into addressing this separately. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For #7549
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed)