Skip to content

Commit

Permalink
Refactor stackTraceRequest
Browse files Browse the repository at this point in the history
Fix #893
  • Loading branch information
bpringe committed Dec 26, 2020
1 parent 40f5fc1 commit 4f985b1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/debugger/calva-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -177,8 +176,7 @@ class CalvaDebugSession extends LoggingDebugSession {
protected async stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments, request?: DebugProtocol.Request): Promise<void> {

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));
Expand All @@ -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)];

Expand Down

0 comments on commit 4f985b1

Please sign in to comment.