Skip to content

feat: give DAP exception breakpoint filters a condition - #1760

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/dap-exception-filter-conditions
Oct 26, 2026
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/dap-exception-filter-conditions

Conversation

@lagergren

@lagergren lagergren commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

A debug adapter can let an exception breakpoint filter take a condition, such as the exception types to stop at: ExceptionBreakpointsFilter.supportsCondition, with conditionDescription saying what the condition means, and the condition sent in the filter options of setExceptionBreakpoints when the adapter has supportsExceptionFilterOptions. LSP4IJ sends only the enabled filters' ids, so such a condition cannot be given, and exception breakpoints by type are unavailable in IntelliJ while VS Code offers them.

The fix

  • The Exception Breakpoints panel gains a Condition column, editable for the filters that support a condition. An empty cell shows the condition's description, greyed. Changing a condition sends the filters again, as checking or unchecking one does.
  • The conditions are kept by filter id in the debug adapter's filter settings (FilterItemSettings), beside the enabled filters.
  • setExceptionBreakpoints sends an enabled filter that supports a condition and has one in filterOptions, with its condition, when the debug adapter supports filter options. Every other filter is sent by its id in filters, as before.
  • The breakpoint handler keeps each debug adapter's capabilities from initialize(), to know whether it supports filter options.
  • The user guide describes the column.

Test

New DAPExceptionFilterConditionsTest, with the real breakpoint handler and panel as in DAPBreakpointHandlerBaseTest:

  • Against a debug adapter with filter options, an enabled filter with a condition is sent in filterOptions, trimmed. Conditions on a filter that doesn't support them, or on a disabled filter, are not sent.
  • A debug adapter without filter options gets the enabled filters' ids only.
  • The conditions are read back by a later handler for the same debug adapter, an empty condition removes one, and they survive XML serialization of the filter settings.

Without the handler change, the first test fails: uncaught is sent without its condition.

Native check, in IntelliJ IDEA 2026.2.3 with the Ecstasy language server's debug adapter, which supports a condition on both its exception filters: exception classes separated by commas. A program first throws and catches an IllegalState, then throws an IllegalArgument. Stopped before the first throw, All Exceptions is given the condition IllegalArgument in the new column, and Uncaught Exceptions is unchecked. With a plugin built from this branch, the caught IllegalState doesn't stop the program, which stops where the IllegalArgument is thrown. With one built from main, which sends no condition, the same setup stops at the caught IllegalState.

./gradlew check: 745 tests, 3 skipped. 7 tests fail on my macOS machine, on main without this change as well: LSPIJUtils_applyWorkspaceEdit_{Go,TypeScript,Scala,Zig}Test and CommandExecutorTest. Each reports File accessed outside allowed roots for a temporary file: the file is reached as /private/var/folders/…/T/…, while the allowed root is /var/folders/…/T/, and /var is a symlink to /private/var on macOS. They are unrelated to this change.

A debug adapter can let an exception breakpoint filter take a
condition (ExceptionBreakpointsFilter.supportsCondition, with
conditionDescription saying what it means), such as the exception
types to stop at, and receive it in the filter options of
setExceptionBreakpoints (supportsExceptionFilterOptions). LSP4IJ only
sent the enabled filters' ids.

- The Exception Breakpoints panel gains a Condition column, editable
  for the filters which support a condition; an empty cell shows the
  condition's description, greyed. A changed condition is sent, as a
  checked or unchecked filter is.
- The conditions are kept by filter id in the DAP server's filter
  settings, beside the enabled filters.
- setExceptionBreakpoints sends an enabled filter which supports a
  condition and has one in filterOptions, with its condition, when
  the debug adapter supports filter options; every other filter is
  sent by its id in filters, as before.
- The breakpoint handler keeps each debug adapter's capabilities from
  initialize().

The user guide describes the column.

Tests: DAPExceptionFilterConditionsTest. Against a debug adapter with
filter options, an enabled filter with a condition is sent in
filterOptions (trimmed), while conditions on a filter which doesn't
support them, or on a disabled filter, are not sent; a debug adapter
without filter options gets the enabled filters' ids only. Conditions
are read back by a later handler of the same debug adapter and
removed by an empty one, and survive XML serialization of the filter
settings. With the handler change reverted, the first test fails:
"uncaught" is sent without its condition.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50690724-dfd4-4dff-bb11-ea346ea19322
📥 Commits

Reviewing files that changed from the base of the PR and between ef2b18c and a4f73d2.

📒 Files selected for processing: 8
  • docs/dap/UserGuide.md
  • src/main/java/com/redhat/devtools/lsp4ij/dap/breakpoints/BreakpointHandlerBase.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPBreakpointHandlerBase.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPExceptionBreakpointsPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/settings/UserDefinedDebugAdapterServerSettings.java
  • src/main/resources/messages/DAPBundle.properties
  • src/main/resources/messages/DAPBundle_zh_CN.properties
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPExceptionFilterConditionsTest.java

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.71429% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.46%. Comparing base (ef2b18c) to head (a4f73d2).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
.../dap/breakpoints/DAPExceptionBreakpointsPanel.java 37.03% 14 Missing and 3 partials ⚠️
...p4ij/dap/breakpoints/DAPBreakpointHandlerBase.java 85.00% 2 Missing and 1 partial ⚠️
.../lsp4ij/dap/breakpoints/BreakpointHandlerBase.java 80.00% 0 Missing and 1 partial ⚠️
...ettings/UserDefinedDebugAdapterServerSettings.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1760      +/-   ##
==========================================
+ Coverage   32.28%   32.46%   +0.17%     
==========================================
  Files         753      753              
  Lines       28015    28064      +49     
  Branches     5598     4270    -1328     
==========================================
+ Hits         9044     9110      +66     
+ Misses      17344    17322      -22     
- Partials     1627     1632       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@angelozerr angelozerr added enhancement New feature or request dap Debugging Adapter Protocol labels Oct 26, 2026
@angelozerr angelozerr added this to the 0.21.1 milestone Oct 26, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Oct 26, 2026
@angelozerr
angelozerr merged commit 4c777ba into redhat-developer:main Oct 26, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Java Tooling Oct 26, 2026
@angelozerr

Copy link
Copy Markdown
Contributor

Thanks @lagergren !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dap Debugging Adapter Protocol enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants