Repository navigation
feat(dap): a hit condition for line breakpoints - #1787
Merged
angelozerr merged 1 commit intoOct 28, 2026
Merged
Conversation
LSP4IJ sent a line breakpoint's condition and log message, but no hit condition: DAPBreakpointHandlerBase.addSourceBreakpoint() never set SourceBreakpoint.hitCondition, and IntelliJ line breakpoints have no hit count to send. Function and data breakpoints already have one. A DAP line breakpoint now has a hit condition, which the DAP server reads, such as 3 or >= 3, as function and data breakpoints do: it is kept with the breakpoint's properties, changed in the Breakpoints dialog, and sent as the source breakpoint's hitCondition. A DAP server without supportsHitConditionalBreakpoints ignores it. Tests: DAPBreakpointHitConditionTest. ./gradlew test: 921 tests, 3 skipped, and the 7 failures "File accessed outside allowed roots" which main has on macOS too.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1787 +/- ##
==========================================
- Coverage 36.38% 36.36% -0.03%
==========================================
Files 779 780 +1
Lines 29678 29707 +29
Branches 4505 5950 +1445
==========================================
+ Hits 10798 10802 +4
- Misses 16992 17020 +28
+ Partials 1888 1885 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
Thanks @lagergren ! |
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 line breakpoint can't have a hit condition.
DAPBreakpointHandlerBase.addSourceBreakpoint()sends a line breakpoint's condition and log message but never setsSourceBreakpoint.hitCondition, and IntelliJ's line breakpoints have no hit count of their own to send. So with a debug adapter that hassupportsHitConditionalBreakpoints, a breakpoint can't stop only at, say, its third hit. Function breakpoints (#1780) and data breakpoints (#1782) already have a hit condition.The fix
DAPBreakpointProperties, which had no state, keeps a hit condition that the DAP server reads, such as3or>= 3, and saves it with the breakpoint.DAPBreakpointTypehas a properties panel with aHit conditionfield in theBreakpointsdialog, as the function and data breakpoint types have. A change firesbreakpointChanged, so the debug sessions send the breakpoints again.addSourceBreakpoint()sends a non-blank hit condition as the source breakpoint'shitCondition. A breakpoint of another plugin's type, forwarded to the DAP server, has none. Neither does the "Run to Cursor" breakpoint.Tests
New
DAPBreakpointHitConditionTest:setBreakpointsrequest carries each line breakpoint's hit condition, and no hit condition for a breakpoint without one or with a blank one../gradlew test: 921 tests, 3 skipped. The 7 failures are "File accessed outside allowed roots" (LSPIJUtils_applyWorkspaceEdit_{Go,TypeScript,Scala,Zig}TestandCommandExecutorTest.testExecuteCommandWithValidTextEdit), whichmainalso has on macOS.Not checked natively yet.