Repository navigation
feat(dap): let a descriptor start its process for an attach - #1798
Merged
angelozerr merged 1 commit intoOct 29, 2026
Merged
angelozerr merged 1 commit into
angelozerr merged 1 commit into
Conversation
An attach started a NopProcessHandler in place of the descriptor's server, and the DAP client then reached the Debug Adapter by the address and port of the attach configuration. A descriptor whose Debug Adapter is reached through its process, such as one that carries its sessions over another connection, could only launch. DebugAdapterDescriptor.startServer(DebugMode) starts the session's process: the server for a launch, and by default nothing for an attach, as before; such a descriptor overrides it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1798 +/- ##
==========================================
+ Coverage 36.66% 36.69% +0.02%
==========================================
Files 781 781
Lines 29843 29842 -1
Branches 4533 4532 -1
==========================================
+ Hits 10943 10951 +8
+ Misses 16994 16988 -6
+ Partials 1906 1903 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
@lagergren your PR is good, but I notice (I remember that for now) that the DAP dev guide is very simple and not finished. As you are working on DAP LSP4IJ extension, if you have time please improve this guide. |
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.
DAPCommandLineState.startProcess()starts aNopProcessHandlerfor an attach, in place of the descriptor'sstartServer(), and the DAP client then reaches the Debug Adapter at the address and port ofgetServerReadyConfig(DebugMode.ATTACH). That is right for a Debug Adapter that already runs and listens, but a descriptor whose Debug Adapter is reached through the process thatstartServer()starts can only launch: in attach mode it has no process, and without a port the client reads the streams of theNopProcessHandler.The Ecstasy plugin's Debug Adapter runs in its language server, and
startServer()returns a process handler that carries the session over the language server's connection. Its new attach configuration, which attaches to a program started outside the IDE, keepsgetDebugMode()atLAUNCHso that the handler is started, and overridescreateClient()to make the client inATTACHmode, so that it sendsattachand, on stop,disconnect.The change
DebugAdapterDescriptor.startServer(DebugMode): the session's process. For a launch it isstartServer(); for an attach it is aNopProcessHandlerby default, as before. A descriptor that reaches its Debug Adapter through its process overrides it.DAPCommandLineState.startProcess()calls it.docs/dap/DeveloperGuide.mdsays when to override it.Tests
New
DAPCommandLineStateTest: a launch starts the descriptor's server; an attach starts aNopProcessHandlerand never callsstartServer(); and an attach of a descriptor that overridesstartServer(DebugMode)starts its process.With
startProcess()as it was, the last case fails../gradlew test: 944 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: the Ecstasy plugin builds on 0.21.0, which has nostartServer(DebugMode).Design question
@angelozerr, the descriptor could instead say only whether its attach needs its process, with something like
boolean isAttachThroughProcess(), andDAPCommandLineStatewould callstartServer()itself. I chose the overload because it lets a descriptor start a different process for an attach, but I'm happy to switch.