debug: always allow bps to be removed

fixes #14357
This commit is contained in:
isidor
2016-11-01 10:18:21 +01:00
parent 69b02b120a
commit 92e0559c76
2 changed files with 13 additions and 9 deletions

View File

@@ -549,12 +549,14 @@ class ToggleBreakpointAction extends EditorAction {
const lineNumber = editor.getPosition().lineNumber;
const modelUri = editor.getModel().uri;
if (debugService.getConfigurationManager().canSetBreakpointsIn(editor.getModel())) {
const bp = debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.uri.toString() === modelUri.toString()).pop();
const bp = debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.uri.toString() === modelUri.toString()).pop();
return bp ? debugService.removeBreakpoints(bp.getId())
: debugService.addBreakpoints(modelUri, [{ lineNumber }]);
if (bp) {
return debugService.removeBreakpoints(bp.getId());
}
if (debugService.getConfigurationManager().canSetBreakpointsIn(editor.getModel())) {
return debugService.addBreakpoints(modelUri, [{ lineNumber }]);
}
}
}

View File

@@ -76,14 +76,16 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
if (e.target.type !== editorcommon.MouseTargetType.GUTTER_GLYPH_MARGIN || /* after last line */ e.target.detail) {
return;
}
if (!this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel())) {
return;
}
const canSetBreakpoints = this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel());
const lineNumber = e.target.position.lineNumber;
const uri = this.editor.getModel().uri;
if (e.event.rightButton || (env.isMacintosh && e.event.leftButton && e.event.ctrlKey)) {
if (!canSetBreakpoints) {
return;
}
const anchor = { x: e.event.posx + 1, y: e.event.posy };
const breakpoint = this.debugService.getModel().getBreakpoints().filter(bp => bp.lineNumber === lineNumber && bp.uri.toString() === uri.toString()).pop();
@@ -98,7 +100,7 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
if (breakpoint) {
this.debugService.removeBreakpoints(breakpoint.getId());
} else {
} else if (canSetBreakpoints) {
this.debugService.addBreakpoints(uri, [{ lineNumber }]);
}
}