提交 3a3c6b34 编写于 作者: I isidor

debug polish: do not expose sendAllBreakpoints

上级 de63841a
......@@ -249,7 +249,7 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
this.debugService.openOrRevealSource(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
// user clicked on 'Load More Stack Frames', get those stack frames and refresh the tree.
......@@ -393,7 +393,7 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
this.debugService.openOrRevealSource(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}));
......
......@@ -308,9 +308,8 @@ export interface IDebugService {
toggleBreakpoint(IRawBreakpoint): TPromise<void>;
enableOrDisableAllBreakpoints(enabled: boolean): TPromise<void>;
toggleEnablement(element: IEnablement): TPromise<void>;
toggleBreakpointsActivated(): TPromise<void>;
setBreakpointsActivated(activated: boolean): TPromise<void>;
removeAllBreakpoints(): TPromise<any>;
sendAllBreakpoints(): TPromise<any>;
addFunctionBreakpoint(): void;
renameFunctionBreakpoint(id: string, newFunctionName: string): TPromise<void>;
......@@ -318,10 +317,7 @@ export interface IDebugService {
addReplExpression(name: string): TPromise<void>;
clearReplExpressions(): void;
logToRepl(value: string, severity?: severity): void;
logToRepl(value: { [key: string]: any }, severity?: severity): void;
logToRepl(value: string | { [key: string]: any }, severity?: severity): void;
appendReplOutput(value: string, severity?: severity): void;
addWatchExpression(name?: string): TPromise<void>;
......@@ -356,7 +352,7 @@ export interface IDebugService {
/**
* Opens a new or reveals an already visible editor showing the source.
*/
openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any>;
openOrRevealSource(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any>;
}
// Editor interfaces
......
......@@ -487,8 +487,8 @@ export class Model implements debug.IModel {
return this.breakpointsActivated;
}
public toggleBreakpointsActivated(): void {
this.breakpointsActivated = !this.breakpointsActivated;
public setBreakpointsActivated(activated: boolean): void {
this.breakpointsActivated = activated;
this._onDidChangeBreakpoints.fire();
}
......@@ -576,9 +576,7 @@ export class Model implements debug.IModel {
.then(() => this._onDidChangeREPLElements.fire());
}
public logToRepl(value: string, severity?: severity): void;
public logToRepl(value: { [key: string]: any }, severity?: severity): void;
public logToRepl(value: any, severity?: severity): void {
public logToRepl(value: string | { [key: string]: any }, severity?: severity): void {
let elements:OutputElement[] = [];
let previousOutput = this.replElements.length && (<ValueOutputElement>this.replElements[this.replElements.length - 1]);
......@@ -596,7 +594,7 @@ export class Model implements debug.IModel {
// key-value output
else {
elements.push(new KeyValueOutputElement(value.prototype, value, nls.localize('snapshotObj', "Only primitive values are shown for this object.")));
elements.push(new KeyValueOutputElement((<any>value).prototype, value, nls.localize('snapshotObj', "Only primitive values are shown for this object.")));
}
if (elements.length) {
......
......@@ -361,7 +361,7 @@ export class ToggleBreakpointsActivatedAction extends AbstractDebugAction {
}
public run(): TPromise<any> {
return this.debugService.toggleBreakpointsActivated();
return this.debugService.setBreakpointsActivated(!this.debugService.getModel().areBreakpointsActivated());
}
protected isEnabled(state: debug.State): boolean {
......@@ -379,7 +379,7 @@ export class ReapplyBreakpointsAction extends AbstractDebugAction {
}
public run(): TPromise<any> {
return this.debugService.sendAllBreakpoints();
return this.debugService.setBreakpointsActivated(true);
}
protected isEnabled(state: debug.State): boolean {
......
......@@ -258,7 +258,7 @@ export class DebugService implements debug.IDebugService {
this.setFocusedStackFrameAndEvaluate(stackFrameToFocus).done(null, errors.onUnexpectedError);
aria.alert(nls.localize('debuggingPaused', "Debugging paused, reason {0}, {1} {2}", event.body.reason, stackFrameToFocus.source ? stackFrameToFocus.source.name : '', stackFrameToFocus.lineNumber));
return this.openOrRevealEditor(stackFrameToFocus.source, stackFrameToFocus.lineNumber, false, false);
return this.openOrRevealSource(stackFrameToFocus.source, stackFrameToFocus.lineNumber, false, false);
} else {
this.setFocusedStackFrameAndEvaluate(null).done(null, errors.onUnexpectedError);
}
......@@ -467,8 +467,8 @@ export class DebugService implements debug.IDebugService {
return TPromise.join(urisToClear.map(uri => this.sendBreakpoints(uri)));
}
public toggleBreakpointsActivated(): TPromise<void> {
this.model.toggleBreakpointsActivated();
public setBreakpointsActivated(activated: boolean): TPromise<void> {
this.model.setBreakpointsActivated(activated);
return this.sendAllBreakpoints();
}
......@@ -491,9 +491,7 @@ export class DebugService implements debug.IDebugService {
return this.model.addReplExpression(this.session, this.viewModel.getFocusedStackFrame(), name);
}
public logToRepl(value: string, severity?: severity): void;
public logToRepl(value: { [key: string]: any }, severity?: severity): void;
public logToRepl(value: any, severity?: severity): void {
public logToRepl(value: string | { [key: string]: any }, severity?: severity): void {
this.model.logToRepl(value, severity);
}
......@@ -753,7 +751,7 @@ export class DebugService implements debug.IDebugService {
return this.viewModel;
}
public openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any> {
public openOrRevealSource(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any> {
const visibleEditors = this.editorService.getVisibleEditors();
for (let i = 0; i < visibleEditors.length; i++) {
const fileInput = wbeditorcommon.asFileEditorInput(visibleEditors[i].input);
......@@ -832,7 +830,7 @@ export class DebugService implements debug.IDebugService {
}
}
public sendAllBreakpoints(): TPromise<any> {
private sendAllBreakpoints(): TPromise<any> {
return TPromise.join(arrays.distinct(this.model.getBreakpoints(), bp => bp.source.uri.toString()).map(bp => this.sendBreakpoints(bp.source.uri)))
.then(() => this.sendFunctionBreakpoints())
// send exception breakpoints at the end since some debug adapters rely on the order
......
......@@ -44,9 +44,9 @@ suite('Debug - Model', () => {
model.removeBreakpoints([model.getBreakpoints().pop()]);
assert.equal(model.getBreakpoints().length, 2);
model.toggleBreakpointsActivated();
model.setBreakpointsActivated(false);
assert.equal(model.areBreakpointsActivated(), false);
model.toggleBreakpointsActivated();
model.setBreakpointsActivated(true);
assert.equal(model.areBreakpointsActivated(), true);
});
......
......@@ -51,7 +51,7 @@ export class MockDebugService implements debug.IDebugService {
return TPromise.as(null);
}
public toggleBreakpointsActivated(): TPromise<void> {
public setBreakpointsActivated(): TPromise<void> {
return TPromise.as(null);
}
......@@ -59,10 +59,6 @@ export class MockDebugService implements debug.IDebugService {
return TPromise.as(null);
}
public sendAllBreakpoints(): TPromise<any> {
return TPromise.as(null);
}
public addFunctionBreakpoint(): void {}
public renameFunctionBreakpoint(id: string, newFunctionName: string): TPromise<void> {
......@@ -115,7 +111,7 @@ export class MockDebugService implements debug.IDebugService {
return null;
}
public openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any> {
public openOrRevealSource(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any> {
return TPromise.as(null);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册