Skip to content
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

make caching more robust; fixes #69534 #70073

Merged
merged 1 commit into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb

// dto helpers

public $sessionCached(sessionID: string) {
// remember that the EH has cached the session and we do not have to send it again
this._sessions.add(sessionID);
}


getSessionDto(session: undefined): undefined;
getSessionDto(session: IDebugSession): IDebugSessionDto;
getSessionDto(session: IDebugSession | undefined): IDebugSessionDto | undefined;
Expand All @@ -294,7 +300,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
if (this._sessions.has(sessionID)) {
return sessionID;
} else {
this._sessions.add(sessionID);
// this._sessions.add(sessionID); // #69534: see $sessionCached above
return {
id: sessionID,
type: session.configuration.type,
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/node/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ export type DebugSessionUUID = string;

export interface MainThreadDebugServiceShape extends IDisposable {
$registerDebugTypes(debugTypes: string[]): void;
$sessionCached(sessionID: string): void;
$acceptDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
$acceptDAError(handle: number, name: string, message: string, stack: string): void;
$acceptDAExit(handle: number, code: number, signal: string): void;
Expand Down
16 changes: 10 additions & 6 deletions src/vs/workbench/api/node/extHostDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,19 +794,23 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (typeof dto === 'string') {
return this._debugSessions.get(dto);
} else {
const folder = await this.getFolder(dto.folderUri);
const debugSession = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, folder, dto.configuration);
this._debugSessions.set(debugSession.id, debugSession);
return debugSession;
let ds = this._debugSessions.get(dto.id);
if (!ds) {
const folder = await this.getFolder(dto.folderUri);
ds = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, folder, dto.configuration);
this._debugSessions.set(ds.id, ds);
this._debugServiceProxy.$sessionCached(ds.id);
}
return ds;
}
}
return undefined;
}

private async getFolder(_folderUri: UriComponents | undefined): Promise<vscode.WorkspaceFolder | undefined> {
private getFolder(_folderUri: UriComponents | undefined): Promise<vscode.WorkspaceFolder | undefined> {
if (_folderUri) {
const folderURI = URI.revive(_folderUri);
return await this._workspaceService.resolveWorkspaceFolder(folderURI);
return this._workspaceService.resolveWorkspaceFolder(folderURI);
}
return undefined;
}
Expand Down