提交 f1404198 编写于 作者: A André Weinand

proposed logMessage API; fixes #45643

上级 8ae0b0cb
......@@ -378,6 +378,13 @@ declare module 'vscode' {
debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
}
export interface Breakpoint {
/**
* An optional message that gets logged when this breakpoint is hit.
*/
readonly logMessage?: string;
}
//#endregion
//#region Rob, Matt: logging
......
......@@ -101,7 +101,8 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
lineNumber: l.line + 1,
column: l.character > 0 ? l.character + 1 : 0,
condition: l.condition,
hitCondition: l.hitCondition
hitCondition: l.hitCondition,
logMessage: l.logMessage
}
);
this.debugService.addBreakpoints(uri.revive(dto.uri), rawbps);
......@@ -126,9 +127,10 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
type: 'function',
id: fbp.getId(),
enabled: fbp.enabled,
functionName: fbp.name,
condition: fbp.condition,
hitCondition: fbp.hitCondition,
/* condition: fbp.condition */
logMessage: fbp.logMessage,
functionName: fbp.name
};
} else {
const sbp = <IBreakpoint>bp;
......@@ -138,6 +140,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
enabled: sbp.enabled,
condition: sbp.condition,
hitCondition: sbp.hitCondition,
logMessage: sbp.logMessage,
uri: sbp.uri,
line: sbp.lineNumber > 0 ? sbp.lineNumber - 1 : 0,
character: (typeof sbp.column === 'number' && sbp.column > 0) ? sbp.column - 1 : 0,
......
......@@ -725,21 +725,22 @@ export interface ExtHostTaskShape {
$provideTasks(handle: number): TPromise<TaskSet>;
}
export interface IFunctionBreakpointDto {
type: 'function';
export interface IBreakpointDto {
type: string;
id?: string;
enabled: boolean;
condition?: string;
hitCondition?: string;
logMessage?: string;
}
export interface IFunctionBreakpointDto extends IBreakpointDto {
type: 'function';
functionName: string;
}
export interface ISourceBreakpointDto {
export interface ISourceBreakpointDto extends IBreakpointDto {
type: 'source';
id?: string;
enabled: boolean;
condition?: string;
hitCondition?: string;
uri: UriComponents;
line: number;
character: number;
......@@ -759,6 +760,7 @@ export interface ISourceMultiBreakpointDto {
enabled: boolean;
condition?: string;
hitCondition?: string;
logMessage?: string;
line: number;
character: number;
}[];
......
......@@ -111,18 +111,15 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!this._breakpoints.has(bpd.id)) {
let bp: vscode.Breakpoint;
if (bpd.type === 'function') {
bp = new FunctionBreakpoint(bpd.functionName, bpd.enabled, bpd.condition, bpd.hitCondition);
bp = new FunctionBreakpoint(bpd.functionName, bpd.enabled, bpd.condition, bpd.hitCondition, bpd.logMessage);
} else {
const uri = URI.revive(bpd.uri);
bp = new SourceBreakpoint(new Location(uri, new Position(bpd.line, bpd.character)), bpd.enabled, bpd.condition, bpd.hitCondition);
bp = new SourceBreakpoint(new Location(uri, new Position(bpd.line, bpd.character)), bpd.enabled, bpd.condition, bpd.hitCondition, bpd.logMessage);
}
bp['_id'] = bpd.id;
this._breakpoints.set(bpd.id, bp);
a.push(bp);
}
}
}
......@@ -145,12 +142,14 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
fbp.enabled = bpd.enabled;
fbp.condition = bpd.condition;
fbp.hitCondition = bpd.hitCondition;
fbp.logMessage = bpd.logMessage;
fbp.functionName = bpd.functionName;
} else if (bp instanceof SourceBreakpoint && bpd.type === 'source') {
const sbp = <any>bp;
sbp.enabled = bpd.enabled;
sbp.condition = bpd.condition;
sbp.hitCondition = bpd.hitCondition;
sbp.logMessage = bpd.logMessage;
sbp.location = new Location(URI.revive(bpd.uri), new Position(bpd.line, bpd.character));
}
c.push(bp);
......@@ -206,6 +205,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
enabled: bp.enabled,
condition: bp.condition,
hitCondition: bp.hitCondition,
logMessage: bp.logMessage,
line: bp.location.range.start.line,
character: bp.location.range.start.character
});
......@@ -214,9 +214,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
type: 'function',
id: bp['_id'],
enabled: bp.enabled,
functionName: bp.functionName,
hitCondition: bp.hitCondition,
condition: bp.condition
logMessage: bp.logMessage,
condition: bp.condition,
functionName: bp.functionName
});
}
}
......
......@@ -1673,8 +1673,9 @@ export class Breakpoint {
readonly enabled: boolean;
readonly condition?: string;
readonly hitCondition?: string;
readonly logMessage?: string;
protected constructor(enabled?: boolean, condition?: string, hitCondition?: string) {
protected constructor(enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string) {
this.enabled = typeof enabled === 'boolean' ? enabled : true;
if (typeof condition === 'string') {
this.condition = condition;
......@@ -1682,14 +1683,17 @@ export class Breakpoint {
if (typeof hitCondition === 'string') {
this.hitCondition = hitCondition;
}
if (typeof logMessage === 'string') {
this.logMessage = logMessage;
}
}
}
export class SourceBreakpoint extends Breakpoint {
readonly location: Location;
constructor(location: Location, enabled?: boolean, condition?: string, hitCondition?: string) {
super(enabled, condition, hitCondition);
constructor(location: Location, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string) {
super(enabled, condition, hitCondition, logMessage);
if (location === null) {
throw illegalArgument('location');
}
......@@ -1700,8 +1704,8 @@ export class SourceBreakpoint extends Breakpoint {
export class FunctionBreakpoint extends Breakpoint {
readonly functionName: string;
constructor(functionName: string, enabled?: boolean, condition?: string, hitCondition?: string) {
super(enabled, condition, hitCondition);
constructor(functionName: string, enabled?: boolean, condition?: string, hitCondition?: string, logMessage?: string) {
super(enabled, condition, hitCondition, logMessage);
if (!functionName) {
throw illegalArgument('functionName');
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册