提交 ac46ca2a 编写于 作者: A Andre Weinand

make caching more robust; fixes #69534

上级 63d4b744
...@@ -285,6 +285,12 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb ...@@ -285,6 +285,12 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
// dto helpers // 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: undefined): undefined;
getSessionDto(session: IDebugSession): IDebugSessionDto; getSessionDto(session: IDebugSession): IDebugSessionDto;
getSessionDto(session: IDebugSession | undefined): IDebugSessionDto | undefined; getSessionDto(session: IDebugSession | undefined): IDebugSessionDto | undefined;
...@@ -294,7 +300,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb ...@@ -294,7 +300,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
if (this._sessions.has(sessionID)) { if (this._sessions.has(sessionID)) {
return sessionID; return sessionID;
} else { } else {
this._sessions.add(sessionID); // this._sessions.add(sessionID); // #69534: see $sessionCached above
return { return {
id: sessionID, id: sessionID,
type: session.configuration.type, type: session.configuration.type,
......
...@@ -636,6 +636,7 @@ export type DebugSessionUUID = string; ...@@ -636,6 +636,7 @@ export type DebugSessionUUID = string;
export interface MainThreadDebugServiceShape extends IDisposable { export interface MainThreadDebugServiceShape extends IDisposable {
$registerDebugTypes(debugTypes: string[]): void; $registerDebugTypes(debugTypes: string[]): void;
$sessionCached(sessionID: string): void;
$acceptDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void; $acceptDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
$acceptDAError(handle: number, name: string, message: string, stack: string): void; $acceptDAError(handle: number, name: string, message: string, stack: string): void;
$acceptDAExit(handle: number, code: number, signal: string): void; $acceptDAExit(handle: number, code: number, signal: string): void;
......
...@@ -794,19 +794,23 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -794,19 +794,23 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (typeof dto === 'string') { if (typeof dto === 'string') {
return this._debugSessions.get(dto); return this._debugSessions.get(dto);
} else { } else {
const folder = await this.getFolder(dto.folderUri); let ds = this._debugSessions.get(dto.id);
const debugSession = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, folder, dto.configuration); if (!ds) {
this._debugSessions.set(debugSession.id, debugSession); const folder = await this.getFolder(dto.folderUri);
return debugSession; 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; return undefined;
} }
private async getFolder(_folderUri: UriComponents | undefined): Promise<vscode.WorkspaceFolder | undefined> { private getFolder(_folderUri: UriComponents | undefined): Promise<vscode.WorkspaceFolder | undefined> {
if (_folderUri) { if (_folderUri) {
const folderURI = URI.revive(_folderUri); const folderURI = URI.revive(_folderUri);
return await this._workspaceService.resolveWorkspaceFolder(folderURI); return this._workspaceService.resolveWorkspaceFolder(folderURI);
} }
return undefined; return undefined;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册