Repository navigation
fix: handle virtual files in DAP breakpoint matching - #1457
Merged
angelozerr merged 1 commit intoApr 7, 2026
Merged
angelozerr merged 1 commit into
angelozerr merged 1 commit into
Conversation
angelozerr
reviewed
Apr 7, 2026
| if (fileInBreakpoint.toNioPath().equals(filePath) && line == lineNumber) { | ||
| return breakpoint; | ||
| try { | ||
| if (fileInBreakpoint.toNioPath().equals(filePath) && line == lineNumber) { |
Contributor
There was a problem hiding this comment.
Instead of doing try/catch, it would be better to check fileInBreakpoint.isInLocalFileSystem()
Contributor
Author
There was a problem hiding this comment.
Of course, sorry that I missed that. Let me amend that...
Contributor
Author
There was a problem hiding this comment.
@angelozerr okay like this? Seems to still work for me.
Contributor
|
@ericbodden nice catch! Please see my comments. |
…r#1447) DAPBreakpointHandlerBase.findBreakpoint() calls VirtualFile.toNioPath() to compare breakpoint file paths. For sourceReference-backed virtual files (DAPFile extends LightVirtualFile), toNioPath() throws UnsupportedOperationException since these files have no filesystem path. This uncaught exception silently kills the entire stopped-event handler in DAPClient.stopped(), preventing positionReached()/breakpointReached() from ever being called. As a result, the debugger UI does not update on any stopped event that occurs after a breakpoint has been set in a virtual file (no line highlighting, no scopes/variables fetch, disabled Resume/Step buttons). The fix catches UnsupportedOperationException and falls back to comparing VirtualFile.getPath() as a string, which works for both local files and in-memory virtual files. Fixes redhat-developer#1447 Co-Authored-By: Claude Opus 4.6 <[email protected]>
ericbodden
force-pushed
the
fix/dap-breakpoint-virtual-file-crash
branch
from
April 7, 2026 13:52
4d767fd to
b65ce5c
Compare
Contributor
|
LGTM, thanks @ericbodden ! |
Contributor
|
@ericbodden could you add a link in https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#who-is-using-lsp4ij which explains that you use LSP4IJ for your DAP server. And if you like LSP4IJ, please add a review in JetBrains Marketplace to help us to promote LSP4IJ. Thanks! |
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
Fixes #1447
DAPBreakpointHandlerBase.findBreakpoint()callsVirtualFile.toNioPath()to compare breakpoint file paths against the DAP source path. ForsourceReference-backed virtual files (DAPFileextendsLightVirtualFile),toNioPath()throwsUnsupportedOperationExceptionsince these files exist only in memory with no filesystem path.This uncaught exception silently kills the entire
thenAcceptAsynccallback inDAPClient.stopped(), preventingpositionReached()/breakpointReached()from ever being called. As a result, the debugger UI does not update on anystoppedevent that occurs after a breakpoint has been set in a virtual file:scopes/variablesrequests sent to the DAP serverThe first
stoppedevent (e.g.stopOnEntry) works because no breakpoints have been registered yet, so the loop infindBreakpoint()iterates over an empty list without hitting the crash.Root cause
In
DAPBreakpointHandlerBase.findBreakpoint():DAPFile→LightVirtualFile→VirtualFile.toNioPath()throwsUnsupportedOperationException.Fix
Catch
UnsupportedOperationExceptionand fall back to comparingVirtualFile.getPath()as a string, which works for both local files and in-memory virtual files.Test plan
stopOnEntry: truein a DAP launch config usingsourceReference-backed virtual files🤖 Generated with Claude Code