From 4f985b1eb01165eca73783a5c0d3d41e888c7caf Mon Sep 17 00:00:00 2001 From: Brandon Ringe Date: Sat, 26 Dec 2020 15:05:45 -0800 Subject: [PATCH] Refactor stackTraceRequest Fix #893 --- src/debugger/calva-debug.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/debugger/calva-debug.ts b/src/debugger/calva-debug.ts index 526474804..d883e9ae0 100644 --- a/src/debugger/calva-debug.ts +++ b/src/debugger/calva-debug.ts @@ -14,7 +14,6 @@ import annotations from '../providers/annotations'; import { NReplSession } from '../nrepl'; import debugDecorations from './decorations'; import * as namespace from '../namespace'; -import { removeFileSchemeFromUri } from '../util/string'; const CALVA_DEBUG_CONFIGURATION: DebugConfiguration = { type: 'clojure', @@ -177,8 +176,7 @@ class CalvaDebugSession extends LoggingDebugSession { protected async stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments, request?: DebugProtocol.Request): Promise { const debugResponse = state.deref().get(DEBUG_RESPONSE_KEY); - const uri = vscode.Uri.parse(debugResponse.file); - const document = await vscode.workspace.openTextDocument(uri); + const document = await vscode.workspace.openTextDocument(vscode.Uri.parse(debugResponse.file)); const positionLine = convertOneBasedToZeroBased(debugResponse.line); const positionColumn = convertOneBasedToZeroBased(debugResponse.column); const offset = document.offsetAt(new Position(positionLine, positionColumn)); @@ -196,8 +194,8 @@ class CalvaDebugSession extends LoggingDebugSession { const [line, column] = tokenCursor.rowCol; - const pathWithoutScheme = uri.path.includes(':') ? uri.path.split(':')[1] : uri.path; - const source = new Source(basename(pathWithoutScheme), pathWithoutScheme); + // Pass scheme in path argument to Source contructor so that if it's a jar file it's handled correctly + const source = new Source(basename(debugResponse.file), debugResponse.file); const name = tokenCursor.getFunction(); const stackFrames = [new StackFrame(0, name, source, line + 1, column + 1)];