Fixes #7366 Remove leaked breakpoint after stopping with run-to-cursor

This commit is contained in:
Ed Munoz 2016-06-07 16:05:09 -07:00
parent 9b767f947d
commit d377857bcb
3 changed files with 7 additions and 14 deletions

View file

@ -257,11 +257,6 @@ export interface IRawDebugSession {
custom(request: string, args: any): TPromise<DebugProtocol.Response>;
/**
* Allows to register on each debug session stop event.
*/
onDidStop: Event<DebugProtocol.StoppedEvent>;
onDidEvent: Event<DebugProtocol.Event>;
}

View file

@ -557,11 +557,13 @@ export class RunToCursorAction extends EditorAction {
const lineNumber = this.editor.getPosition().lineNumber;
const uri = this.editor.getModel().uri;
const oneTimeListener = this.debugService.getActiveSession().onDidStop(() => {
const toRemove = this.debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.source.uri.toString() === uri.toString()).pop();
this.debugService.removeBreakpoints(toRemove.getId());
oneTimeListener.dispose();
const oneTimeListener = this.debugService.getActiveSession().onDidEvent(event => {
if (event.event === 'stopped' || event.event === 'exit') {
const toRemove = this.debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.source.uri.toString() === uri.toString()).pop();
this.debugService.removeBreakpoints(toRemove.getId());
oneTimeListener.dispose();
}
});
return this.debugService.addBreakpoints([{ uri, lineNumber }]).then(() => {

View file

@ -135,10 +135,6 @@ class MockRawSession implements debug.IRawDebugSession {
};
}
public get onDidStop(): Event<DebugProtocol.StoppedEvent> {
return null;
}
public get onDidEvent(): Event<DebugProtocol.Event> {
return null;
}