Add support for latest version of PTVSD as an experimental debugger#745
Add support for latest version of PTVSD as an experimental debugger#745DonJayamanne merged 114 commits intomicrosoft:masterfrom
Conversation
Archive of 0.7.0
* 'master' of https://github.com/Microsoft/vscode-python: Fixes #56 list all environments (#219) Fixes #57 Disable activation on debugging (#220) Fixes #26 Do not run linters when linters are disabled (#222)
* upstream/master: Fix typo in README.md (#252) Disable linter without workspaces (#241)
* upstream/master: Fix feedback service (#246) Fix django context initializer (#248) disable generation of tags file upon extension load (#264)
* upstream/master: Resolve pythonPath before comparing it to shebang (#273)
* upstream/master:
Fixes #22 to Detect anaconda from known locations (#221)
Use workspaceFolder token instead of workspaceRoot (#267)
Fix registry lookup response (#224)
Fix issues when running without debugging and debugged code terminates (#249)
* upstream/master: Fix debugging tests (#304)
* upstream/master: Remove jupyter functionality in favor of Jupyter extension (#302) Drop Python 2 URLs (#307)
* upstream/master: Remove setting python.formatting.formatOnSave in favor of the vs code setting (#312)
* upstream/master: Remove setting linting.lintOnTextChange as it was never implemented (#315)
* upstream/master: Fix travis build error (#326)
* upstream/master: add new npm deps with improved gulp for dev (#328)
* upstream/master: Update version of inversify package (#329)
* upstream/master: Document our dev process (#330)
* upstream/master: Document contribution to the code along with coding standards (#321)
* upstream/master: Add Simplified Chinese translation of commands (#240)
* upstream/master: Fix package.json (#347)
* upstream/master: #34, #110 - suppress Intellisense in strings and comments (#339) Re-factor code python execution framework (#345)
* upstream/master: Fix linters to make use of the new python code execution framework (#360) Update the versioning scheme (#356) Make npm happy in regards to line endings (#357)
* upstream/master: Ensure python path is not set if already set in user settings (#369) Use 'an' rather than 'a' before vowel words (#373)
* upstream/master: Use new environment variable parser (#362)
| import { DebugProtocol } from 'vscode-debugprotocol'; | ||
|
|
||
| export class Event extends Message implements DebugProtocol.Event { | ||
| public event: string; |
There was a problem hiding this comment.
Removed it, found that VS Code has already got this.
| this.messagesToLog = []; | ||
| } | ||
| private fromDataCallbackHandler = (data: string | Buffer) => { | ||
| this.logMessages(['From Client:', (data as Buffer).toString('utf8')]); |
There was a problem hiding this comment.
Looks like it casts data to buffer even if it is string?
There was a problem hiding this comment.
Yes, we're only dealing with buffer here, this is a logger for the protocol stream, we'll never handle strings. never.
There was a problem hiding this comment.
The problem is streams have a generic call back of either string or buffer,
Either way this won't be a problem as we're just using the 'toString' method.
I need to cast it so that I can pass the arg.
| private stream?: Readable; | ||
| constructor() { | ||
| super(); | ||
| this.contentLength = -1; |
There was a problem hiding this comment.
just set it right at the declaration?
| this.pythonProcess = pythonProcess; | ||
| this.debugServer = new LocalDebugServer(this.debugSession, this.pythonProcess, this.args); | ||
| public CreateDebugServer(pythonProcess?: IPythonProcess, serviceContainer?: IServiceContainer): BaseDebugServer { | ||
| if ((this.args as LaunchRequestArguments).type === 'pythonExperimental') { |
There was a problem hiding this comment.
ctor receives args as LaunchRequestArguments - do we still need to cast?
There was a problem hiding this comment.
Yes, this is a generic class used for remote and local debugging. In remote debugging the args is a different type.
The property args is any in the base class. Could probably use generics, but didn't want to make too many changes to the existing debugger.
There was a problem hiding this comment.
Ok, thats a lame excuse, will fix it. lol
* upstream/master: Limit Jedi RAM consumption (#744) Fix debug test failure (#739) Ensure paths are always using forward slashes in terminal commands and args (#732)
int19h
left a comment
There was a problem hiding this comment.
My TS-fu is weak, so this review is mostly about protocol handling.
Yes it is. |
| this.pythonProcess = pythonProcess; | ||
| this.debugServer = new RemoteDebugServer(this.debugSession, this.pythonProcess, this.args); | ||
| public CreateDebugServer(pythonProcess?: IPythonProcess): BaseDebugServer { | ||
| this.pythonProcess = pythonProcess!; |
There was a problem hiding this comment.
So it is never actually null or can it be? If not, then ? prob not needed
There was a problem hiding this comment.
Optional parameter for other implementations of this class.
| this.sendEvent(new TerminatedEvent()); | ||
| } | ||
| protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments) { | ||
| if ((args as any).diagnosticLogging === true) { |
There was a problem hiding this comment.
do we need to cast to any if is strongly typed?
| import { IDebugStreamProvider, IProtocolLogger, IProtocolMessageWriter, IProtocolParser } from './types'; | ||
|
|
||
| export class PythonDebugger extends DebugSession { | ||
| public debugServer?: BaseDebugServer; |
There was a problem hiding this comment.
readonly for public fields? Or turn into getters? At least it is preferable practice in C#
|
|
||
| // Lets start our debugger. | ||
| const session = new PythonDebugger(serviceContainer, isServerMode); | ||
| session.setRunAsServer(isServerMode); |
There was a problem hiding this comment.
if we are passing isServerMode down to the session ctor, can it setRunAsServer internally?
src/client/debugger/mainV2.ts
Outdated
|
|
||
| function dispose() { | ||
| if (session) { | ||
| session.shutdown(); |
src/client/debugger/Main.ts
Outdated
| } | ||
| @capturePerformanceTelemetry('launch') | ||
| protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { | ||
| if ((args as any).diagnosticLogging === true) { |
Fixes #740