Repository navigation
Add support for remote debugging with experimental debugger - #1230
Don Jayamanne (DonJayamanne) merged 20 commits into
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1230 +/- ##
==========================================
+ Coverage 70.94% 71.07% +0.13%
==========================================
Files 266 267 +1
Lines 12284 12350 +66
Branches 2172 2188 +16
==========================================
+ Hits 8715 8778 +63
+ Misses 3445 3432 -13
- Partials 124 140 +16
Continue to review full report at Codecov.
|
fcf15dd to
673ef14
Compare
673ef14 to
9032acf
Compare
| // tslint:disable:quotemark ordered-imports no-any no-empty curly member-ordering one-line max-func-body-length no-var-self prefer-const cyclomatic-complexity prefer-template | ||
|
|
||
| import { DebugSession } from "vscode-debugadapter"; | ||
| import { IPythonProcess, IDebugServer, AttachRequestArguments } from "../Common/Contracts"; |
There was a problem hiding this comment.
Evil double quotes?
There was a problem hiding this comment.
aaah, copy paste.
| this.provideDefaults(workspaceFolder, config); | ||
| if (config.request === 'attach') { | ||
| // tslint:disable-next-line:no-any | ||
| this.provideAttachDefaults(workspaceFolder, config as any as PythonAttachDebugConfiguration); |
There was a problem hiding this comment.
Interesting - why is getting casted twice
There was a problem hiding this comment.
config can be of two types. Modified code accordingly to make it clearer (using a union type).
| } | ||
| protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void { | ||
| this.sendResponse(response); | ||
| const launcher = CreateAttachDebugClient(args as AttachRequestArguments, this); |
There was a problem hiding this comment.
args seems to be of that type already
|
|
||
| this.initializeRequestDeferred = createDeferred<DebugProtocol.InitializeRequest>(); | ||
| this.launchRequestDeferred = createDeferred<DebugProtocol.LaunchRequest>(); | ||
| this.attachRequestDeferred = createDeferred<DebugProtocol.LaunchRequest>(); |
There was a problem hiding this comment.
DebugProtocol.AttachRequest?
| const config = debugConfiguration as PythonLaunchDebugConfiguration | PythonAttachDebugConfiguration; | ||
| const numberOfSettings = Object.keys(config); | ||
| const workspaceFolder = this.getWorkspaceFolder(folder, config); | ||
| const workspaceFolder = this.getWorkspaceFolder(folder, config as PythonLaunchDebugConfiguration); |
There was a problem hiding this comment.
getWorkspaceFolder doesn't seem to be using config (it passes it to getProgram which does not use it.
| export type PythonAttachDebugConfiguration = DebugConfiguration & AttachRequestArguments; | ||
|
|
||
| @injectable() | ||
| export abstract class BaseConfigurationProvider implements DebugConfigurationProvider { |
There was a problem hiding this comment.
Might be worth splitting into AttachConfigurationProvider and LaunchConfigurationProvider and have static factory like getConfigurationProvider(mode). Class has bunch of getLaunchX and getAttachX and casts and checks for the debug mode.
There was a problem hiding this comment.
Unfortunately there can only be one debug configuration, that handles both launch and attach (& more in the future).
I've cleaned up the code,
There was a problem hiding this comment.
There could be one class that contains a handler specific to the mode. I.e. debug configuration class acts as a proxy and simply forwards calls to 'launch or 'attach handler
| } | ||
|
|
||
| if (this.killPTVSDProcess && this.ptvsdProcessId) { | ||
| if (this.launchOrAttach === 'launch' && this.ptvsdProcessId) { |
There was a problem hiding this comment.
In big VS Stop Debugging terminates debuggee even on attach. There is separate Detach command if user wants to keep debuggee running. I guess VSC does it differently.
There was a problem hiding this comment.
In VSC, we don't have the ability to kill for attach scenarios, at least not yet (the protocol supports it for VS), the UI doesn't.
I'll create an issue so we add support for this, this way if the UI does add support for this in VSC, it'll work without much changes.
There was a problem hiding this comment.
On second thought, we won't need to do anything. There's a ticket item in PTVSD to support this functionality ( required by VS).
in reality PTVSD is the debug adapter, hence it will kill the process if it needs to (the stuff we have here, is a temporary bridge to connect VSC to PTVSD - to perform initial handshake).
I.e. nothing to do here.
| if (this.launchOrAttach === 'launch') { | ||
| const debugSoketProtocolParser = this.serviceContainer.get<IProtocolParser>(IProtocolParser); | ||
| debugSoketProtocolParser.connect(this.ptvsdSocket); | ||
| debugSoketProtocolParser.once('event_process', (proc: DebugProtocol.ProcessEvent) => { |
| "python.formatting.provider": "yapf", | ||
| "python.linting.pylintUseMinimalCheckers": false, | ||
| "python.pythonPath": "python" | ||
| "python.linting.pylintUseMinimalCheckers": false |
There was a problem hiding this comment.
Intentional?
Fixes #1229
Fixes #1265
This pull request: