Add support for palette/context menu commands to live share#4574
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4574 +/- ##
========================================
+ Coverage 58% 78% +20%
========================================
Files 367 445 +78
Lines 15790 21080 +5290
Branches 2462 3424 +962
========================================
+ Hits 9130 16272 +7142
+ Misses 6047 4802 -1245
+ Partials 613 6 -607
|
| } | ||
| } | ||
|
|
||
| private async waitForObservable(subscriber: Subscriber<ICell[]>, code: string, file: string, line: number, id: string) : Promise<void> { |
There was a problem hiding this comment.
All of this code moved into the responseQueue class. #ByDesign
| if (!uri && result) { | ||
| const connectionInfo = result.getConnectionInfo(); | ||
| if (connectionInfo) { | ||
| const portMatch = RegExpValues.ExtractPortRegex.exec(connectionInfo.baseUrl); |
There was a problem hiding this comment.
portMatch [](start = 26, length = 9)
Port forwarding is now done by the server object instead. This allows the port forwarding to be removed when the server is disposed (which happens when doing an export to a file) #ByDesign
| } | ||
|
|
||
| return result; | ||
| public getServer(options?: INotebookServerOptions) : Promise<INotebookServer | undefined> { |
There was a problem hiding this comment.
getServer [](start = 11, length = 9)
This API is now how the 'cached' server is requested. Variables uses this now. #ByDesign
| constructor( | ||
| @inject(IWorkspaceService) private workspaceService: IWorkspaceService, | ||
| @inject(ICurrentProcess) private currentProcess: ICurrentProcess, | ||
| @inject(IThemeFinder) private themeFinder: IThemeFinder, |
There was a problem hiding this comment.
This new class finds the theme json files #ByDesign
| ConnectRemoteJupyter = 'DATASCIENCE.CONNECTREMOTEJUPYTER', | ||
| ConnectFailedJupyter = 'DATASCIENCE.CONNECTFAILEDJUPYTER' | ||
| ConnectFailedJupyter = 'DATASCIENCE.CONNECTFAILEDJUPYTER', | ||
| RemoteAddCode = 'DATASCIENCE.LIVESHARE.ADDCODE' |
There was a problem hiding this comment.
LIVESHARE [](start = 33, length = 9)
This is the single telemetry point we'll get for liveshare situations. It happens every time somebody tries to run a cell #Resolved
There was a problem hiding this comment.
| export const ArgsSplitterRegEx = /([^\s,]+)/g; | ||
| } | ||
|
|
||
| export namespace HistoryMessages { |
There was a problem hiding this comment.
I moved all of these into historyTypes #ByDesign
| } | ||
|
|
||
| private registerCommands(): void { | ||
| let disposable = this.commandBroker.registerCommand(Commands.RunAllCells, this.runAllCells, this); |
There was a problem hiding this comment.
commandBroker [](start = 30, length = 13)
I got rid of the commandBroker as mirroring commands doesn't really make sense. #ByDesign
There was a problem hiding this comment.
This also means the 'id' is not propagated from the commands anymore. It is propagated through the 'remoteAddCode' callback. That's how both sides end up with the same 'id' in the request they make.
In reply to: 260903495 [](ancestors = 260903495)
|
|
||
| // tslint:disable-next-line:no-any | ||
| private dispatchMessage<M extends IHistoryMapping, T extends keyof M>(message: T, payload: any, handler: (args : M[T]) => void) { | ||
| const args = payload as M[T]; |
There was a problem hiding this comment.
This function enforces type safety on messages passed around between history, the interactive window, and other history's in a live share scenario #ByDesign
| } | ||
| } | ||
|
|
||
| private showInformationMessage(message: string, question?: string) : Thenable<string | undefined> { |
There was a problem hiding this comment.
This function exists merely to satisfy hygiene. It didn't like passing an undefined string to the applicationShell.showInformationMessage #ByDesign
| max-height: 100%; | ||
| } | ||
|
|
||
| .cell-button-image svg{ |
There was a problem hiding this comment.
Forgot about this fix. This fixes the tooltip on our buttons that had a title specified. #ByDesign
|
|
||
| public async runSelectionOrLine(id: string): Promise<void> { | ||
| // tslint:disable-next-line:no-any | ||
| public async runSelectionOrLine(... args: any[]): Promise<void> { |
There was a problem hiding this comment.
... args: any[] [](start = 36, length = 15)
Remove if not needed. #Resolved
There was a problem hiding this comment.
| let extensionsPath = path.join(currentPath, 'resources', 'app', 'extensions'); | ||
| if (!(await fs.pathExists(extensionsPath))) { | ||
| // Might be on mac or linux. try a different path | ||
| currentPath = path.resolve(currentPath, '../../../..'); |
There was a problem hiding this comment.
currentPath = path.resolve(currentPath, '../../../..'); [](start = 12, length = 55)
This looks odd. The default themes on mac / linux are saved out of the exe directory? Is this relying on users doing a default install of some type to move back the right number of levels? #ByDesign
There was a problem hiding this comment.
This is what I found on a mac/linux machine when I originally wrote this code (this algorithm was what we used before). Right now it's actually a backup as the comment above is technically wrong. On my machine all of the colors were found through the extensions api.
In reply to: 260958142 [](ancestors = 260958142)
There was a problem hiding this comment.
It's relying on the fact that the exe for vscode is 4 levels above its root install location.
In reply to: 260958949 [](ancestors = 260958949,260958142)
There was a problem hiding this comment.
I think I'll just update the comment.
In reply to: 260959732 [](ancestors = 260959732,260958949,260958142)
| const fpath = path.join(rootPath, f); | ||
| const data = await this.findMatchingThemeFromJson(fpath, themeName); | ||
| if (data) { | ||
| foundData.push(data); |
There was a problem hiding this comment.
If this is slow, this might be better as findMatchingTheme and just return back the first hit. Looks like you just take the first hit in all cases anyways. If it's not slow then probably fine to leave as is. #Resolved
There was a problem hiding this comment.
This code never runs right now, so it's not slow :)
In reply to: 260959779 [](ancestors = 260959779)
There was a problem hiding this comment.
But you're right. I should return a single one.
In reply to: 260960097 [](ancestors = 260960097,260959779)
| } | ||
| } | ||
|
|
||
| private async waitForObservable(subscriber: Subscriber<ICell[]>, code: string, file: string, line: number, id: string) : Promise<void> { |
There was a problem hiding this comment.
ync waitForObservable(subscribe [](start = 14, length = 31)
Thanks, this makes it much cleaner here with the new class. At least from my perspective. #Resolved
For #4520, #4197
Revamp how commands are passed around. Now they are mirror'd at the history level instead of the command level as something like 'Run Current Cell' is context sensitive (so you can't just send it to the host).
Also fixed colors and the issue with the interactive window not coming up (because of file-matcher hanging). Did this here because it was making it a pain to debug this.
Still more work to do:
package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed)