Fix issues with LiveShare and triple quotes#5084
Conversation
Add test for tabs to make sure they stay in comments
Needed to save a copy of a cell before sending it. Otherwise subsequent messages overwrite the cell in use.
| MOCHA_FILE: '$(Build.ArtifactStagingDirectory)/test-junit.xml' # All test files will write their JUnit xml output to this file, clobbering the last time it was written. | ||
| MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). | ||
| # VSC_PYTHON_FORCE_LOGGING: true - Enable this to turn on console output for the logger | ||
| VSC_PYTHON_FORCE_LOGGING: true # Enable this to turn on console output for the logger |
There was a problem hiding this comment.
VSC_PYTHON_FORCE_LOGGING [](start = 2, length = 24)
This is from the Monday meeting. I said I'd enable this on my next submission. #Resolved
| if (this.requestLog.has(id)) { | ||
| // This must be a local call that occurred after a guest call. Just | ||
| // use the local responses to return the results. | ||
| return this.localResponses.waitForObservable(code, id); |
There was a problem hiding this comment.
localResponses [](start = 24, length = 14)
The root change for liveshare was to separate the list of cached responses into two groups - local and guest. Local is used when the guest makes a request before the host can. This happens on export with output and sometimes when clicking/submitting through the input box. This is the root cause of the bug we saw during our demo. #Resolved
| return (r.pos === pos) && | ||
| (foundId === r.id || !foundId) && | ||
| (code === r.code) && | ||
| (!r.cells || (r.cells && r.cells[0].file === file && r.cells[0].line === line)); |
There was a problem hiding this comment.
Realized we have an id for all requests now so checking file is unnecessary. It was the part of the original bug I found where if the guest submitted first, the file name wouldn't match. #Resolved
| // Look through all of our responses that are queued up and see if they make a | ||
| // waiting promise resolve | ||
| for (let i = 0; i < this.responseQueue.length; i += 1) { | ||
| const response = this.responseQueue[i]; |
There was a problem hiding this comment.
responseQueue [](start = 34, length = 13)
Also realized rechecking here through all responses is redundant as they've already been checked before. Only need to check the new response. #Resolved
| subscriber.error(this.sessionStartTime, new Error(localize.DataScience.jupyterServerCrashed().format(exitCode.toString()))); | ||
| subscriber.complete(this.sessionStartTime); | ||
| } else { | ||
| const request = this.generateRequest(concatMultilineString(stripComments(subscriber.cell.data.source)), silent); |
There was a problem hiding this comment.
stripComments [](start = 75, length = 13)
This is the bug fix for the 5102 bug. #Resolved
| return callback; | ||
| } | ||
|
|
||
| private getApi() : Promise<vsls.LiveShare | null> { |
There was a problem hiding this comment.
Refactored this so that the promise doesn't start in the ctor. It was easier to debug when stuff was happening if the promise wasn't starting right away. #Resolved
| public send(service: vsls.SharedService) { | ||
| this.responseQueue.forEach(r => service.notify(LiveShareCommands.serverResponse, r)); | ||
| public send(service: vsls.SharedService, translator: (r: IServerResponse) => IServerResponse) { | ||
| this.responseQueue.forEach(r => service.notify(LiveShareCommands.serverResponse, translator(r))); |
There was a problem hiding this comment.
Host to guest file remapping now happens at send time instead of response push time. That's because of the 'local' copy the host requires. #Resolved
| } | ||
|
|
||
| private onStatusChanged(_s: Session.ISession, a: Kernel.Status) { | ||
| traceInfo(`Status changed to ${a} from OnStatusChangedEvent`); |
There was a problem hiding this comment.
too noisy I assume? #ByDesign
There was a problem hiding this comment.
Yeah. Not necessary too as the 'wait for idle' status is pretty much the same thing.
In reply to: 271499147 [](ancestors = 271499147)
| } | ||
|
|
||
| private onServerResponse = (args: Object) => { | ||
| const er = args as IExecuteObservableResponse; |
There was a problem hiding this comment.
Can't hostJupyterServer pass something that is just an IServerResponse and not an IExecuteObservableResponse? #WontFix
There was a problem hiding this comment.
Yep. Exceptions also come through. The trace will just show undefined then.
In reply to: 271502241 [](ancestors = 271502241)
There was a problem hiding this comment.
There was a problem hiding this comment.
Do you think I should skip logging?
In reply to: 271502541 [](ancestors = 271502541,271502440,271502241)
There was a problem hiding this comment.
Got it. Just wasn't sure if you wanted undefined printed out. Seems ok.
In reply to: 271502541 [](ancestors = 271502541,271502440,271502241)
There was a problem hiding this comment.
If er is not a ExecuteObservableResponse
In reply to: 271502746 [](ancestors = 271502746,271502541,271502440,271502241)
There was a problem hiding this comment.
It's probably ok. My brains just says null exception when I see this. Your choice,
In reply to: 271502858 [](ancestors = 271502858,271502746,271502541,271502440,271502241)
For #5012 and bugs found while testing the fix for 5012 around liveshare
package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed)