From 5d653651366296bfdfc2efdfe7b018a3ed23bc0f Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Tue, 20 Feb 2018 16:40:13 +0100 Subject: [PATCH] make breakpoints API final; fixes #43492 --- src/vs/vscode.d.ts | 116 ++++++++++++++++-- src/vs/vscode.proposed.d.ts | 97 --------------- src/vs/workbench/api/node/extHost.api.impl.ts | 16 +-- 3 files changed, 113 insertions(+), 116 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index a6d31fc4b46..3ca7322116d 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -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; + 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; + /** + * An [event](#Event) that is emitted when the set of breakpoints is added, removed, or changed. + */ + export const onDidChangeBreakpoints: Event; + + /** * 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; + + /** + * 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; } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 88767411c16..dc2a142150c 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -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; - - /** - * 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. */ diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 50c74c0efb3..466456f5bc3 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -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); - }) + } };