From f43307aa935125060d9d5e83ddc0ba3751070597 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 11 Aug 2020 16:46:39 +0200 Subject: [PATCH] run to cursor: If the cursor is on a line different than the one the debugger is currently paused on, then send the breakpoint at column 0 on the line otherwise set it at the precise column fixes #102199 --- .../contrib/debug/browser/debugEditorActions.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index c7249d02612..2954fda0f33 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -144,7 +144,15 @@ export class RunToCursorAction extends EditorAction { const uri = editor.getModel().uri; const bpExists = !!(debugService.getModel().getBreakpoints({ column: position.column, lineNumber: position.lineNumber, uri }).length); if (!bpExists) { - const breakpoints = await debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column: position.column }], 'debugEditorActions.runToCursorAction'); + let column = 0; + const focusedStackFrame = debugService.getViewModel().focusedStackFrame; + if (focusedStackFrame && focusedStackFrame.source.uri.toString() === uri.toString() && focusedStackFrame.range.startLineNumber === position.lineNumber) { + // If the cursor is on a line different than the one the debugger is currently paused on, then send the breakpoint at column 0 on the line + // otherwise set it at the precise column #102199 + column = position.column; + } + + const breakpoints = await debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column }], 'debugEditorActions.runToCursorAction'); if (breakpoints && breakpoints.length) { breakpointToRemove = breakpoints[0]; } -- GitLab