Repository navigation
feat(dap): data breakpoints - #1782
Merged
angelozerr merged 1 commit intoOct 28, 2026
Merged
Conversation
LSP4IJ never sent 'dataBreakpointInfo' or 'setDataBreakpoints' and had no breakpoint type for them, so the data breakpoints of a DAP server, which stop the program when a value changes, could not be used from IntelliJ. - "Break on Value Change" (DAP.BreakOnValueChange), in the context menu of the Variables and Watches views (XDebugger.ValueGroup), is shown for a DAP value whose DAP server advertises supportsDataBreakpoints. It asks that DAP server 'dataBreakpointInfo' with the variablesReference of the value's container and the value's name; a watch, which has no container, sends its expression and the frame. When the answer has no dataId, the debug tool window shows the description the DAP server gives as the reason, and nothing is added. - The action finds the selected DAP value with XDebuggerTreeBackendOnlyActionBase.getSelectedValue (IntelliJ 2025.3 and later, through Java reflection), and otherwise with XDebuggerTreeActionBase.getSelectedValue: with the split debugger of IntelliJ 2026.1 and later, the views' tree holds frontend proxies of the values (FrontendXNamedValue), not the DAP values, so the action was never shown there. - Otherwise a "DAP Data Breakpoint" (dap-data-breakpoint) is added. Its properties hold the dataId, the description, which is its text in the Breakpoints dialog, the access type (write if offered, else the first one offered), canPersist, the id of the DAP server configuration, and, not saved, the DAP server which gave the dataId. It has the Condition, Suspend and logging options of a line breakpoint, and a hit condition which its properties panel edits. - DAPDataBreakpointHandler sends the enabled data breakpoints of each DAP server, all of them, with 'setDataBreakpoints' when the session starts and whenever one is added, changed or removed, to each DAP server of the session which advertises supportsDataBreakpoints; the removal of the last one sends an empty request. As for function breakpoints, the answer shows each verified, or invalid with the DAP server's message, the answer to an older request is ignored, and 'breakpoint' changed events update them by id. A stop names its data breakpoint by hitBreakpointIds, through findBreakpointById, and the stopped event's description, such as "Counter.count changed from 0 to 2", is shown where the program stopped, as an information hint. - A dataId whose canPersist is false or absent is valid only in its session: its breakpoint is removed when that session ends, as IntelliJ removes a temporary breakpoint, so it is not saved in workspace.xml, not sent to a later session, and gone from the Breakpoints dialog. It is also removed before the project is saved on close, and one left over by an IDE which stopped mid-session is removed when the next DAP session registers it. A persistable one is kept, unbound, and sent to the later sessions of the same DAP server configuration. - The presentation of a non-line breakpoint, which the function breakpoints set, moves to BreakpointHandlerBase for both. The error hint display of an exception stop shows the data breakpoint hint too. - DAPSupport.md marks DataBreakpointInfo and SetDataBreakpoints supported, with supportsDataBreakpoints and DataBreakpoint, and the user guide describes data breakpoints. Tests: DAPDataBreakpointHandlerTest, DAPDataBreakpointPropertiesTest, DAPClientDataBreakpointTest, DAPClientDataBreakpointHintTest and DAPBreakOnValueChangeActionTest, with proxy DAP servers: the dataBreakpointInfo arguments, a refusal adding nothing, replace-all on add and removal, each DAP server getting its own data, verified and invalid answers, a stop matched by hitBreakpointIds, the stop hint, and non-persistable breakpoints removed at session end, at project close and when left over, and not in the saved breakpoint state. DAPBreakOnValueChangeSessionTest runs a debug session attached to a DAP server in the test's process, stopped with a local 'counter' whose field is 'count'. Break on Value Change on the DAPValue of 'count', as the Variables view gets it, is offered, asks dataBreakpointInfo with the variablesReference of 'counter', the name and the frame id, and sends setDataBreakpoints with the dataId; the breakpoint, which can't persist, is gone once the session stops. Against a DAP server without supportsDataBreakpoints, the action is hidden. The session test fails when the action finds no DAP value, and when the session's end removes nothing. Validation, from the JUnit XML: the tests of 'com.redhat.devtools.lsp4ij.dap.*': 175, no failures or skips, 24 of them new. ./gradlew check: 894 tests, 7 failures, 3 skips; the 7 are the ones upstream main already fails on macOS (the applyWorkspaceEdit Go, TypeScript, Scala and Zig tests and CommandExecutorTest.testExecuteCommandWithValidTextEdit), and the skips are inline completion tests. ./gradlew check -x test passes. Native check, in IntelliJ IDEA 2026.2.3 with the Ecstasy (XVM) debug adapter: Break on Value Change, chosen on a counter's field in the Variables view, adds a data breakpoint shown as Counter.count and verified; each of the program's changes to the field stops it on the line after the change, and the breakpoint, which the adapter does not let persist, is gone once the session ends. Limits: the tests run on IntelliJ 2024.2, the project's platform, which has no split debugger; the lookup through XDebuggerTreeBackendOnlyActionBase was checked natively in 2026.2.3 only. main does not compile against 2025.3 (WillRenameFilesMoveHandler, WillRenameFilesRefactoringHelper), so the tests could not run there. A data breakpoint added while its session runs, but whose DAP server is a child session which ends earlier, stays until the parent session ends.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1782 +/- ##
==========================================
+ Coverage 33.70% 35.96% +2.25%
==========================================
Files 770 775 +5
Lines 29145 29452 +307
Branches 5851 4477 -1374
==========================================
+ Hits 9823 10591 +768
+ Misses 17598 16993 -605
- Partials 1724 1868 +144 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
Thanks @lagergren ! |
This was referenced Oct 28, 2026
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.
A DAP server can stop the program when a value changes, rather than at a line, when it advertises
supportsDataBreakpoints. The client first asks which data a variable is (dataBreakpointInfo), by its name and thevariablesReferenceof its container, or by an expression and a frame. The answer has adataId, adescription, the access types offered and whether the data stays the same in a later session (canPersist), or nodataIdand adescriptionof why it can't be watched. The client then sends all its data breakpoints (setDataBreakpoints) each time one of them changes. A stop at one is astoppedevent with the reasondata breakpointandhitBreakpointIds. VS Code offers this as Break on Value Change in its Variables view. LSP4IJ never sent either request and had no breakpoint type for them, andDAPSupport.mdlisted both as unsupported.The change
DAP.BreakOnValueChange) is in the context menu of the Variables and Watches views (XDebugger.ValueGroup). It is shown only for a DAP value whose DAP server advertisessupportsDataBreakpoints.dataBreakpointInfowith thevariablesReferenceof the value's container and the value's name. A watch has no container, so it sends its expression and the frame.dataId, the debug tool window shows thedescriptionas the reason, and nothing is added.XDebuggerTreeBackendOnlyActionBase.getSelectedValue(IntelliJ 2025.3 and later), called by reflection, and otherwise withXDebuggerTreeActionBase.getSelectedValue. With the split debugger of IntelliJ 2026.1 and later, the views' tree holds frontend proxies of the values (FrontendXNamedValue), not the DAP values, so the older lookup never finds aDAPValuethere.XDebuggerTreeBackendOnlyActionBaseis@ApiStatus.Experimental; is reflection on it acceptable to you, or would you rather handle the split debugger another way?dap-data-breakpoint,DAPDataBreakpointType) is added otherwise. It isn't a line's breakpoint.DAPDataBreakpointProperties) hold thedataIdand thedescription, which is its text in the Breakpoints dialog. They also hold the access type (writeif offered, else the first one offered),canPersist, and the id of the DAP server configuration. The DAP server which gave thedataIdis kept too, but not saved.DAPDataBreakpointHandlersends the enabled data breakpoints withsetDataBreakpoints.DebugAdapterDescriptor.createDataBreakpointHandlercreates it, as it creates the other breakpoint handlers.dataIdit gave. They are sent when the session starts, and again whenever one is added, changed or removed, only to a DAP server that advertisessupportsDataBreakpoints. Removing the last one sends an empty request.breakpointevents with the reasonchangedupdate them by id.BreakpointHandlerBasefor both.stoppedevent'shitBreakpointIdsreach a data breakpoint throughDAPDebugProcess.findBreakpointById, so the stop goes throughbreakpointReached, as a line breakpoint's does. Thestoppedevent'sdescription, such asCounter.count changed from 0 to 2, is shown as an information hint where the program stopped. The error hint display of an exception stop shows it too.dataIdwhosecanPersistis false or absent is valid only in its session.workspace.xml, isn't sent to a later session, and is gone from the Breakpoints dialog.DAPProjectLifecycleListener). One left over by an IDE that stopped mid-session is removed when the next DAP session registers it.DAPSupport.mdmarks DataBreakpointInfo and SetDataBreakpoints supported, withsupportsDataBreakpointsandDataBreakpoint, and the user guide gets a "Data breakpoints" section.Test
DAPBreakOnValueChangeSessionTest(2) runs a debug session, attached to a DAP server in the test's process, which stops with a localcounterwhose field iscount:DAPValueofcount, as the Variables view gets it, is offered. It asksdataBreakpointInfowith thevariablesReferenceofcounter, the name and the frame id, and sendssetDataBreakpointswith thedataId. The breakpoint, which can't persist, is gone once the session stops.supportsDataBreakpoints, the action is hidden.DAPDataBreakpointHandlerTest(12), with real IntelliJ data breakpoints and proxyIDebugProtocolServers:supportsDataBreakpointsgets nothing;dataBreakpointInfoarguments, for a variable and for a watch, and a refusal adds nothing;writeif offered, and the data ids, access types, conditions and hit conditions are sent;DAPDataBreakpointPropertiesTest(3): the properties survive a save and load without the DAP server, the panel changes the hit condition, and a breakpoint without a description shows its data id.DAPClientDataBreakpointTest(2) andDAPClientDataBreakpointHintTest(2): a stop reaches the data breakpoint itshitBreakpointIdsname, a stop that names none is not a breakpoint stop, and the stop's description is shown where the program stopped, and nothing for another stop.DAPBreakOnValueChangeActionTest(3): the action is in the Variables and Watches menu, and is hidden when nothing is selected or the value is another debugger's.maindoesn't compile against 2025.3 (WillRenameFilesMoveHandler,WillRenameFilesRefactoringHelper), so the tests couldn't run there. The native check below covers it../gradlew check: 894 tests, 3 skipped. The only failures are the 7 thatmainhas on macOS too (LSPIJUtils_applyWorkspaceEdit_*TestandCommandExecutorTest). The rest ofcheck(Kover, JaCoCo) passes.Native check
IntelliJ IDEA 2026.2.3 with the Ecstasy (XVM) debug adapter, and a plugin built from this branch:
count. Break on Value Change, chosen oncountin the Variables view, added a data breakpoint shown asCounter.count, verified.Line breakpoints, steps, function breakpoints and Reset Frame also still worked with a build of this branch.