From 28c99fa333430c036b7f5c1df70ba8ece2ef17cd Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 13 Jun 2019 15:44:00 +0200 Subject: [PATCH] debug: fix jump to line --- .../contrib/debug/browser/debugCommands.ts | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 13b6bba1b9f..66d9e99bf63 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -106,32 +106,30 @@ export function registerCommands(): void { const debugService = accessor.get(IDebugService); const stackFrame = debugService.getViewModel().focusedStackFrame; const editorService = accessor.get(IEditorService); - const activeEditor = editorService.activeEditor; + const activeEditor = editorService.activeTextEditorWidget; const notificationService = accessor.get(INotificationService); const quickInputService = accessor.get(IQuickInputService); - if (stackFrame && isCodeEditor(activeEditor)) { + if (stackFrame && isCodeEditor(activeEditor) && activeEditor.hasModel()) { const position = activeEditor.getPosition(); - const resource = activeEditor.getResource(); - if (position && resource) { - const source = stackFrame.thread.session.getSourceForUri(resource); - if (source) { - const response = await stackFrame.thread.session.gotoTargets(source, position.lineNumber, position.column); - const targets = response.body.targets; - if (targets.length) { - let id = targets[0].id; - if (targets.length > 1) { - const picks = targets.map(t => ({ label: t.label, _id: t.id })); - const pick = await quickInputService.pick(picks, { placeHolder: nls.localize('chooseLocation', "Choose the specific location") }); - if (!pick) { - return; - } - - id = pick._id; + const resource = activeEditor.getModel().uri; + const source = stackFrame.thread.session.getSourceForUri(resource); + if (source) { + const response = await stackFrame.thread.session.gotoTargets(source, position.lineNumber, position.column); + const targets = response.body.targets; + if (targets.length) { + let id = targets[0].id; + if (targets.length > 1) { + const picks = targets.map(t => ({ label: t.label, _id: t.id })); + const pick = await quickInputService.pick(picks, { placeHolder: nls.localize('chooseLocation', "Choose the specific location") }); + if (!pick) { + return; } - return await stackFrame.thread.session.goto(stackFrame.thread.threadId, id); + id = pick._id; } + + return await stackFrame.thread.session.goto(stackFrame.thread.threadId, id); } } } -- GitLab