Merge from vscode 70dc55955d586ebd427658b43cdb344f2047f9c2 (#6789)

This commit is contained in:
Anthony Dresser
2019-08-16 21:47:46 -07:00
committed by GitHub
parent fb26126bcb
commit 41d8663b09
79 changed files with 1815 additions and 572 deletions

View File

@@ -16,7 +16,7 @@ import { distinct, lastIndex } from 'vs/base/common/arrays';
import { Range, IRange } from 'vs/editor/common/core/range';
import {
ITreeElement, IExpression, IExpressionContainer, IDebugSession, IStackFrame, IExceptionBreakpoint, IBreakpoint, IFunctionBreakpoint, IDebugModel, IReplElementSource,
IThread, IRawModelUpdate, IScope, IRawStoppedDetails, IEnablement, IBreakpointData, IExceptionInfo, IReplElement, IBreakpointsChangeEvent, IBreakpointUpdateData, IBaseBreakpoint, State
IThread, IRawModelUpdate, IScope, IRawStoppedDetails, IEnablement, IBreakpointData, IExceptionInfo, IReplElement, IBreakpointsChangeEvent, IBreakpointUpdateData, IBaseBreakpoint, State, IDataBreakpoint
} from 'vs/workbench/contrib/debug/common/debug';
import { Source, UNKNOWN_SOURCE_LABEL } from 'vs/workbench/contrib/debug/common/debugSource';
import { commonSuffixLength } from 'vs/base/common/strings';
@@ -735,6 +735,34 @@ export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreak
}
}
export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint {
constructor(
public label: string,
public dataId: string,
public canPersist: boolean,
enabled: boolean,
hitCondition: string | undefined,
condition: string | undefined,
logMessage: string | undefined,
id = generateUuid()
) {
super(enabled, hitCondition, condition, logMessage, id);
}
toJSON(): any {
const result = super.toJSON();
result.label = this.label;
result.dataid = this.dataId;
return result;
}
toString(): string {
return this.label;
}
}
export class ExceptionBreakpoint extends Enablement implements IExceptionBreakpoint {
constructor(public filter: string, public label: string, enabled: boolean) {
@@ -778,6 +806,7 @@ export class DebugModel implements IDebugModel {
private breakpointsActivated: boolean,
private functionBreakpoints: FunctionBreakpoint[],
private exceptionBreakpoints: ExceptionBreakpoint[],
private dataBreakopints: DataBreakpoint[],
private watchExpressions: Expression[],
private textFileService: ITextFileService
) {
@@ -918,6 +947,10 @@ export class DebugModel implements IDebugModel {
return this.functionBreakpoints;
}
getDataBreakpoints(): IDataBreakpoint[] {
return this.dataBreakopints;
}
getExceptionBreakpoints(): IExceptionBreakpoint[] {
return this.exceptionBreakpoints;
}
@@ -991,6 +1024,12 @@ export class DebugModel implements IDebugModel {
fbp.setSessionData(sessionId, fbpData);
}
});
this.dataBreakopints.forEach(dbp => {
const dbpData = data.get(dbp.getId());
if (dbpData) {
dbp.setSessionData(sessionId, dbpData);
}
});
this._onDidChangeBreakpoints.fire({
sessionOnly: true
@@ -1001,6 +1040,7 @@ export class DebugModel implements IDebugModel {
this.breakpointsSessionId = sessionId;
this.breakpoints.forEach(bp => bp.setSessionId(sessionId));
this.functionBreakpoints.forEach(fbp => fbp.setSessionId(sessionId));
this.dataBreakopints.forEach(dbp => dbp.setSessionId(sessionId));
this._onDidChangeBreakpoints.fire({
sessionOnly: true
@@ -1038,7 +1078,7 @@ export class DebugModel implements IDebugModel {
}
enableOrDisableAllBreakpoints(enable: boolean): void {
const changed: Array<IBreakpoint | IFunctionBreakpoint> = [];
const changed: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint> = [];
this.breakpoints.forEach(bp => {
if (bp.enabled !== enable) {
@@ -1052,6 +1092,12 @@ export class DebugModel implements IDebugModel {
}
fbp.enabled = enable;
});
this.dataBreakopints.forEach(dbp => {
if (dbp.enabled !== enable) {
changed.push(dbp);
}
dbp.enabled = enable;
});
this._onDidChangeBreakpoints.fire({ changed: changed });
}
@@ -1073,7 +1119,6 @@ export class DebugModel implements IDebugModel {
}
removeFunctionBreakpoints(id?: string): void {
let removed: FunctionBreakpoint[];
if (id) {
removed = this.functionBreakpoints.filter(fbp => fbp.getId() === id);
@@ -1082,7 +1127,25 @@ export class DebugModel implements IDebugModel {
removed = this.functionBreakpoints;
this.functionBreakpoints = [];
}
this._onDidChangeBreakpoints.fire({ removed: removed });
this._onDidChangeBreakpoints.fire({ removed });
}
addDataBreakpoint(label: string, dataId: string, canPersist: boolean): void {
const newDataBreakpoint = new DataBreakpoint(label, dataId, canPersist, true, undefined, undefined, undefined);
this.dataBreakopints.push(newDataBreakpoint);
this._onDidChangeBreakpoints.fire({ added: [newDataBreakpoint] });
}
removeDataBreakpoints(id?: string): void {
let removed: DataBreakpoint[];
if (id) {
removed = this.dataBreakopints.filter(fbp => fbp.getId() === id);
this.dataBreakopints = this.dataBreakopints.filter(fbp => fbp.getId() !== id);
} else {
removed = this.dataBreakopints;
this.dataBreakopints = [];
}
this._onDidChangeBreakpoints.fire({ removed });
}
getWatchExpressions(): Expression[] {