From f2553d24543d72a777ba60213473332809866cb2 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 29 Aug 2023 23:44:39 -0700 Subject: More support for DAP (#4380) * Fix reconnect with --watch * Support setVariable * Support setExpression * Support watch variables * Conditional and hit breakpoints * Support exceptionInfo * Support goto and gotoTargets * Support completions * Support both a URL and UNIX inspector at the same time * Fix url * WIP, add timeouts to figure out issue * Fix messages being dropped from debugger.ts * Progress * Fix breakpoints and ref-event-loop * More fixes * Fix exit * Make hovers better * Fix --hot --- .../bun-debug-adapter-protocol/src/debugger/sourcemap.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts') diff --git a/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts b/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts index 3b3f05c6b..cae0eb526 100644 --- a/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts +++ b/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts @@ -80,7 +80,7 @@ class ActualSourceMap implements SourceMap { const { line: gline, column: gcolumn } = lineRange; return { - line: lineToLine(gline), + line: lineTo0BasedLine(gline), column: columnToColumn(gcolumn), verified: true, }; @@ -144,9 +144,17 @@ class NoopSourceMap implements SourceMap { const defaultSourceMap = new NoopSourceMap(); export function SourceMap(url?: string): SourceMap { - if (!url || !url.startsWith("data:")) { + if (!url) { return defaultSourceMap; } + if (!url.startsWith("data:")) { + const match = url.match(/\/\/[#@]\s*sourceMappingURL=(.*)$/m); + if (!match) { + return defaultSourceMap; + } + const [_, sourceMapUrl] = match; + url = sourceMapUrl; + } try { const [_, base64] = url.split(",", 2); const decoded = Buffer.from(base64, "base64url").toString("utf8"); -- cgit v1.2.3