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

debug polish: do not expose sendAllBreakpoints

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