proposed logMessage API; fixes #45643

This commit is contained in:
André Weinand
2018-03-16 17:08:31 +01:00
parent 8ae0b0cbf8
commit f1404198c3
5 changed files with 39 additions and 22 deletions

View File

@@ -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;
}[];

View File

@@ -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
});
}
}

View File

@@ -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');
}