mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
proposed API: add parentSession to startDebugging; fixes #70219
This commit is contained in:
parent
7d20b64a3a
commit
96eb4cf00d
|
@ -119,7 +119,7 @@ class ServerReadyDetector extends vscode.Disposable {
|
|||
request: 'launch',
|
||||
url: uri,
|
||||
webRoot: args.webRoot || WEB_ROOT
|
||||
});
|
||||
}, session);
|
||||
break;
|
||||
default:
|
||||
// not supported
|
||||
|
|
16
src/vs/vscode.proposed.d.ts
vendored
16
src/vs/vscode.proposed.d.ts
vendored
|
@ -596,6 +596,22 @@ declare module 'vscode' {
|
|||
|
||||
//#region André: debug
|
||||
|
||||
export namespace debug {
|
||||
|
||||
/**
|
||||
* Start debugging by using either a named launch or named compound configuration,
|
||||
* or by directly passing a [DebugConfiguration](#DebugConfiguration).
|
||||
* The named configurations are looked up in '.vscode/launch.json' found in the given folder.
|
||||
* Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date.
|
||||
* Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder.
|
||||
* @param folder The [workspace folder](#WorkspaceFolder) for looking up named configurations and resolving variables or `undefined` for a non-folder setup.
|
||||
* @param nameOrConfiguration Either the name of a debug or compound configuration or a [DebugConfiguration](#DebugConfiguration) object.
|
||||
* @param parent If specified the newly created debug session is registered as a "child" session of a "parent" debug session.
|
||||
* @return A thenable that resolves when debugging could be successfully started.
|
||||
*/
|
||||
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSession?: DebugSession): Thenable<boolean>;
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
||||
export interface DebugConfigurationProvider {
|
||||
|
|
|
@ -226,10 +226,17 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
|
|||
}
|
||||
}
|
||||
|
||||
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig): Promise<boolean> {
|
||||
private getSession(sessionId: DebugSessionUUID | undefined): IDebugSession | undefined {
|
||||
if (sessionId) {
|
||||
return this.debugService.getModel().getSessions(true).filter(s => s.getId() === sessionId).pop();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig, parentSessionID: DebugSessionUUID | undefined): Promise<boolean> {
|
||||
const folderUri = _folderUri ? uri.revive(_folderUri) : undefined;
|
||||
const launch = this.debugService.getConfigurationManager().getLaunch(folderUri);
|
||||
return this.debugService.startDebugging(launch, nameOrConfiguration).then(success => {
|
||||
return this.debugService.startDebugging(launch, nameOrConfiguration, false, this.getSession(parentSessionID)).then(success => {
|
||||
return success;
|
||||
}, err => {
|
||||
return Promise.reject(new Error(err && err.message ? err.message : 'cannot start debugging'));
|
||||
|
|
|
@ -695,8 +695,8 @@ export function createApiFactory(
|
|||
registerDebugAdapterTrackerFactory(debugType: string, factory: vscode.DebugAdapterTrackerFactory) {
|
||||
return extHostDebugService.registerDebugAdapterTrackerFactory(debugType, factory);
|
||||
},
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig);
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig, parentSession);
|
||||
},
|
||||
addBreakpoints(breakpoints: vscode.Breakpoint[]) {
|
||||
return extHostDebugService.addBreakpoints(breakpoints);
|
||||
|
|
|
@ -646,7 +646,7 @@ export interface MainThreadDebugServiceShape extends IDisposable {
|
|||
$unregisterDebugConfigurationProvider(handle: number): void;
|
||||
$unregisterDebugAdapterDescriptorFactory(handle: number): void;
|
||||
$unregisterDebugAdapterTrackerFactory(handle: number): void;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration): Promise<boolean>;
|
||||
$startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSessionID: string | undefined): Promise<boolean>;
|
||||
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise<any>;
|
||||
$appendDebugConsole(value: string): void;
|
||||
$startBreakpointEvents(): void;
|
||||
|
|
|
@ -241,8 +241,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
|||
return this._debugServiceProxy.$unregisterBreakpoints(ids, fids);
|
||||
}
|
||||
|
||||
public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration): Promise<boolean> {
|
||||
return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig);
|
||||
public startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSession?: vscode.DebugSession): Promise<boolean> {
|
||||
return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig, parentSession ? parentSession.id : undefined);
|
||||
}
|
||||
|
||||
public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable {
|
||||
|
|
|
@ -789,7 +789,7 @@ export interface IDebugService {
|
|||
* Returns true if the start debugging was successfull. For compound launches, all configurations have to start successfuly for it to return success.
|
||||
* On errors the startDebugging will throw an error, however some error and cancelations are handled and in that case will simply return false.
|
||||
*/
|
||||
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, noDebug?: boolean): Promise<boolean>;
|
||||
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, noDebug?: boolean, parentSession?: IDebugSession): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Restarts a session or creates a new one if there is no active session.
|
||||
|
|
|
@ -252,7 +252,7 @@ export class DebugService implements IDebugService {
|
|||
* main entry point
|
||||
* properly manages compounds, checks for errors and handles the initializing state.
|
||||
*/
|
||||
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, noDebug = false): Promise<boolean> {
|
||||
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, noDebug = false, parentSession?: IDebugSession): Promise<boolean> {
|
||||
|
||||
this.startInitializingState();
|
||||
// make sure to save all files and that the configuration is up to date
|
||||
|
|
Loading…
Reference in a new issue