mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
API: expose debug console; fixes #36753
This commit is contained in:
@@ -489,6 +489,9 @@ export function createApiFactory(
|
||||
get activeDebugSession() {
|
||||
return extHostDebugService.activeDebugSession;
|
||||
},
|
||||
get console() {
|
||||
return extHostDebugService.debugConsole;
|
||||
},
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig);
|
||||
},
|
||||
@@ -506,7 +509,7 @@ export function createApiFactory(
|
||||
},
|
||||
registerDebugConfigurationProvider(debugType: string, provider: vscode.DebugConfigurationProvider) {
|
||||
return extHostDebugService.registerDebugConfigurationProvider(debugType, provider);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// namespace: credentials
|
||||
|
||||
@@ -404,6 +404,7 @@ export interface MainThreadDebugServiceShape extends IDisposable {
|
||||
$unregisterDebugConfigurationProvider(handle: number): TPromise<any>;
|
||||
$startDebugging(folder: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise<boolean>;
|
||||
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise<any>;
|
||||
$appendDebugConsole(value: string): TPromise<any>;
|
||||
}
|
||||
|
||||
export interface MainThreadCredentialsShape extends IDisposable {
|
||||
|
||||
@@ -40,6 +40,9 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
private _onDidReceiveDebugSessionCustomEvent: Emitter<vscode.DebugSessionCustomEvent>;
|
||||
get onDidReceiveDebugSessionCustomEvent(): Event<vscode.DebugSessionCustomEvent> { return this._onDidReceiveDebugSessionCustomEvent.event; }
|
||||
|
||||
private _debugConsole: ExtHostDebugConsole;
|
||||
get debugConsole(): ExtHostDebugConsole { return this._debugConsole; }
|
||||
|
||||
|
||||
constructor(mainContext: IMainContext, workspace: ExtHostWorkspace) {
|
||||
|
||||
@@ -54,6 +57,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
this._onDidReceiveDebugSessionCustomEvent = new Emitter<vscode.DebugSessionCustomEvent>();
|
||||
|
||||
this._debugServiceProxy = mainContext.get(MainContext.MainThreadDebugService);
|
||||
|
||||
this._debugConsole = new ExtHostDebugConsole(this._debugServiceProxy);
|
||||
}
|
||||
|
||||
public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable {
|
||||
@@ -178,7 +183,7 @@ export class ExtHostDebugSession implements vscode.DebugSession {
|
||||
this._id = id;
|
||||
this._type = type;
|
||||
this._name = name;
|
||||
};
|
||||
}
|
||||
|
||||
public get id(): string {
|
||||
return this._id;
|
||||
@@ -196,3 +201,20 @@ export class ExtHostDebugSession implements vscode.DebugSession {
|
||||
return this._debugServiceProxy.$customDebugAdapterRequest(this._id, command, args);
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtHostDebugConsole implements vscode.DebugConsole {
|
||||
|
||||
private _debugServiceProxy: MainThreadDebugServiceShape;
|
||||
|
||||
constructor(proxy: MainThreadDebugServiceShape) {
|
||||
this._debugServiceProxy = proxy;
|
||||
}
|
||||
|
||||
append(value: string): void {
|
||||
this._debugServiceProxy.$appendDebugConsole(value);
|
||||
}
|
||||
|
||||
appendLine(value: string): void {
|
||||
this.append(value + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user