make breakpoints API final; fixes #43492

This commit is contained in:
Andre Weinand
2018-02-20 16:40:13 +01:00
parent d3a1d6e3a0
commit 5d65365136
3 changed files with 113 additions and 116 deletions

116
src/vs/vscode.d.ts vendored
View File

@@ -6326,21 +6326,79 @@ declare module 'vscode' {
}
/**
* Namespace for dealing with debug sessions.
* An event describing the changes to the set of [breakpoints](#debug.Breakpoint).
*/
export namespace debug {
export interface BreakpointsChangeEvent {
/**
* Added breakpoints.
*/
readonly added: Breakpoint[];
/**
* 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.
* @return A thenable that resolves when debugging could be successfully started.
* Removed breakpoints.
*/
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration): Thenable<boolean>;
readonly removed: Breakpoint[];
/**
* Changed breakpoints.
*/
readonly changed: Breakpoint[];
}
/**
* The base class of all breakpoint types.
*/
export class Breakpoint {
/**
* Is breakpoint enabled.
*/
readonly enabled: boolean;
/**
* An optional expression for conditional breakpoints.
*/
readonly condition?: string;
/**
* An optional expression that controls how many hits of the breakpoint are ignored.
*/
readonly hitCondition?: string;
protected constructor(enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* A breakpoint specified by a source location.
*/
export class SourceBreakpoint extends Breakpoint {
/**
* The source and line position of this breakpoint.
*/
readonly location: Location;
/**
* Create a new breakpoint for a source location.
*/
constructor(location: Location, enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* A breakpoint specified by a function name.
*/
export class FunctionBreakpoint extends Breakpoint {
/**
* The name of the function to which this breakpoint is attached.
*/
readonly functionName: string;
/**
* Create a new function breakpoint.
*/
constructor(functionName: string, enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* Namespace for debug functionality.
*/
export namespace debug {
/**
* The currently active [debug session](#DebugSession) or `undefined`. The active debug session is the one
@@ -6354,6 +6412,12 @@ declare module 'vscode' {
*/
export let activeDebugConsole: DebugConsole;
/**
* List of breakpoints.
*/
export let breakpoints: Breakpoint[];
/**
* An [event](#Event) which fires when the [active debug session](#debug.activeDebugSession)
* has changed. *Note* that the event also fires when the active debug session changes
@@ -6376,6 +6440,12 @@ declare module 'vscode' {
*/
export const onDidTerminateDebugSession: Event<DebugSession>;
/**
* An [event](#Event) that is emitted when the set of breakpoints is added, removed, or changed.
*/
export const onDidChangeBreakpoints: Event<BreakpointsChangeEvent>;
/**
* Register a [debug configuration provider](#DebugConfigurationProvider) for a specifc debug type.
* More than one provider can be registered for the same type.
@@ -6385,6 +6455,30 @@ declare module 'vscode' {
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider): Disposable;
/**
* 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.
* @return A thenable that resolves when debugging could be successfully started.
*/
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration): Thenable<boolean>;
/**
* Add breakpoints.
* @param breakpoints The breakpoints to add.
*/
export function addBreakpoints(breakpoints: Breakpoint[]): void;
/**
* Remove breakpoints.
* @param breakpoints The breakpoints to remove.
*/
export function removeBreakpoints(breakpoints: Breakpoint[]): void;
}
/**

View File

@@ -265,103 +265,6 @@ declare module 'vscode' {
//#endregion
export namespace debug {
/**
* List of breakpoints.
*
* @readonly
*/
export let breakpoints: Breakpoint[];
/**
* An event that is emitted when a breakpoint is added, removed, or changed.
*/
export const onDidChangeBreakpoints: Event<BreakpointsChangeEvent>;
/**
* Add breakpoints.
* @param breakpoints The breakpoints to add.
*/
export function addBreakpoints(breakpoints: Breakpoint[]): void;
/**
* Remove breakpoints.
* @param breakpoints The breakpoints to remove.
*/
export function removeBreakpoints(breakpoints: Breakpoint[]): void;
}
/**
* An event describing a change to the set of [breakpoints](#debug.Breakpoint).
*/
export interface BreakpointsChangeEvent {
/**
* Added breakpoints.
*/
readonly added: Breakpoint[];
/**
* Removed breakpoints.
*/
readonly removed: Breakpoint[];
/**
* Changed breakpoints.
*/
readonly changed: Breakpoint[];
}
/**
* The base class of all breakpoint types.
*/
export class Breakpoint {
/**
* Is breakpoint enabled.
*/
readonly enabled: boolean;
/**
* An optional expression for conditional breakpoints.
*/
readonly condition?: string;
/**
* An optional expression that controls how many hits of the breakpoint are ignored.
*/
readonly hitCondition?: string;
protected constructor(enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* A breakpoint specified by a source location.
*/
export class SourceBreakpoint extends Breakpoint {
/**
* The source and line position of this breakpoint.
*/
readonly location: Location;
/**
* Create a new breakpoint for a source location.
*/
constructor(location: Location, enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* A breakpoint specified by a function name.
*/
export class FunctionBreakpoint extends Breakpoint {
/**
* The name of the function to which this breakpoint is attached.
*/
readonly functionName: string;
/**
* Create a new function breakpoint.
*/
constructor(functionName: string, enabled?: boolean, condition?: string, hitCondition?: string);
}
/**
* Represents a debug adapter executable and optional arguments passed to it.
*/

View File

@@ -538,21 +538,21 @@ export function createApiFactory(
onDidReceiveDebugSessionCustomEvent(listener, thisArg?, disposables?) {
return extHostDebugService.onDidReceiveDebugSessionCustomEvent(listener, thisArg, disposables);
},
onDidChangeBreakpoints: proposedApiFunction(extension, (listener, thisArgs?, disposables?) => {
onDidChangeBreakpoints(listener, thisArgs?, disposables?) {
return extHostDebugService.onDidChangeBreakpoints(listener, thisArgs, disposables);
}),
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
return extHostDebugService.startDebugging(folder, nameOrConfig);
},
registerDebugConfigurationProvider(debugType: string, provider: vscode.DebugConfigurationProvider) {
return extHostDebugService.registerDebugConfigurationProvider(debugType, provider);
},
addBreakpoints: proposedApiFunction(extension, (breakpoints: vscode.Breakpoint[]) => {
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
return extHostDebugService.startDebugging(folder, nameOrConfig);
},
addBreakpoints(breakpoints: vscode.Breakpoint[]) {
return extHostDebugService.addBreakpoints(breakpoints);
}),
removeBreakpoints: proposedApiFunction(extension, (breakpoints: vscode.Breakpoint[]) => {
},
removeBreakpoints(breakpoints: vscode.Breakpoint[]) {
return extHostDebugService.removeBreakpoints(breakpoints);
})
}
};