Repository navigation
Support breakpoints in virtual source documents such as AL .dal files - #137
Open
Fekete Gábor (feketegabor) wants to merge 10 commits into
Open
Fekete Gábor (feketegabor) wants to merge 10 commits into
Fekete Gábor (feketegabor) wants to merge 10 commits into
Conversation
Author
|
@microsoft-github-policy-service agree company="EcoBit Consulting Kft." |
Conflicts: - README.md: keep upstream's new get_debug_status/get_debug_output rows and the fork's virtual-URI parameters for the breakpoint tools. - src/routingDebuggingHandler.ts: keep both imports. Co-Authored-By: Claude Fable 5.2 <[email protected]>
A stop in a virtual document (for example a Business Central `al-preview:` `.dal` source) left `fileFullPath`, `fileName`, `currentLine`, `currentLineContent` and `nextLines` empty: the frame's source path is a URI there, and it was opened as a filesystem path. Open it as the URI it is and report the canonical URI string, which the breakpoint tools accept unchanged. `remove_breakpoint` compared the caller's text with the stored URI, so a URI written with literal spaces never matched and only the percent-encoded form worked. The handler now asks the executor for the canonical form of the requested location. `list_breakpoints` shows the decoded file name. `getBreakpoints()` reported `file:///...` for ordinary files, because every URI string has a scheme; `remove_breakpoint` with a native path therefore found nothing. Files on disk are reported by their native path again. Also: - Move the VS Code-bound URI conversions to `utils/vscodeSourceUri.ts` and keep `utils/sourceUri.ts` host-neutral, since the handler is bundled into the standalone CLI. Drop the duplicate helper and misplaced imports above the copyright header in `debuggingExecutor.ts`. - Restore the changelog entries whose inline code was lost, and the upstream end-of-file state of files the fork only touched there. Co-Authored-By: Claude Fable 5.2 <[email protected]>
`add_breakpoint` and `add_logpoint` open the source to reject a line past its end. For a Business Central `.dal` source that fails until the debug session has stopped: the content is served through the session, and before the first stop the server answers `al/previewDocument` with "An unexpected error occurred invoking 'GetSourceContent'". In a workspace without the symbols, no breakpoint could be set before something else had already stopped the session. An unreadable virtual source is now left unchecked: the breakpoint is set and the result notes that the line was not validated. A readable document is validated as before, and a missing file on disk is still an error. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Remove tests that duplicated another test's coverage or only restated what `vscode.Uri` does: - `debuggingHandler.test.ts`: drop the pass-through test with a hand-written fake executor; the same operations are covered against the real executor in `virtualSourceLocation.test.ts`, which also keeps the out-of-range check. - `sourceUri.test.ts`: keep the Windows drive-letter guard and the file-name helper; the URI conversions are exercised end to end by the breakpoint tests. - `virtualSourceLocation.test.ts`: one case per behaviour instead of several spellings of the same URI. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets an agent debug sources that exist only as VS Code virtual documents, such as Business Central
.dalfiles served through theal-preview:scheme.workingDirectoryrouting hint for virtual sources in multi-window sessionsfileFullPathis the document URI, in the form the breakpoint tools accept unchanged, together with the file name, current line and following linesremove_breakpoint, and show the decoded file name inlist_breakpointscliAdapterConfig.test.tsindependent of the host's path separator and user config directory, so the suite passes on macOS and Linuxmainat 2.4.4Why
DebugMCP previously passed every source argument to
vscode.Uri.file(). That rewrites an AL virtual source such asal-preview://AlLang/.../Customer%20List.dalinto a localfile://URI, so the Microsoft AL extension cannot resolve the document and the breakpoint cannot bind.The same assumption applied on the way back. The AL adapter reports a stack frame's source as a URI with literal spaces:
{ "name": "My Codeunit", "path": "al-preview://allang/<workspace folder>/Codeunit/50100/My Codeunit.dal", "sourceReference": 0 }Opened as a filesystem path, that left the location of every stop empty, so the agent could neither see the line it stopped on nor learn the URI to set a breakpoint with.
Business Central also serves a
.dalsource only once the debug session has stopped. Validating the line by opening the document therefore made it impossible to set a breakpoint in such a source before the first stop.src/utils/sourceUri.tsholds the host-neutral text helpers (it is bundled into the standalone CLI);src/utils/vscodeSourceUri.tsholds the conversions to and fromvscode.Uri. The router can useworkingDirectoryto select the owning editor window; it can also reuse the active target or the sole registered window.Related
#203 fixes two general problems with the state returned right after a stop (#201, #202). It is independent of this change, but with the AL adapter each
step_overreturns an empty first state until it is merged.Validation
npm run check-types,npm run lint,npm run bundle: clean.src/test/virtualSourceLocation.test.ts,src/test/sourceUri.test.tsandsrc/test/routing.test.ts..dalURI, file name, line, line text and the next linesfileFullPathunchanged, and removed it again with the URI written with literal spaceslist_breakpointsshowed the decoded file name.dalthat had not been opened, before the first stop, and got the "line not checked" noteal-preview://allang/<app id>/...) was hit as well🤖 Generated with Claude Code