Skip to content

Extract the Node debug adapter process handling into DebugAdapter - #2336

Merged
akurtakov merged 1 commit into
eclipse-wildwebdeveloper:masterfrom
akurtakov:debug-adapter-class
Dec 3, 2026
Merged

akurtakov merged 1 commit into
eclipse-wildwebdeveloper:masterfrom
akurtakov:debug-adapter-class

Conversation

@akurtakov

Copy link
Copy Markdown
Contributor

The launch (VSCodeJSDebugDelegate) and attach (NodeAttachDebugDelegate) delegates both start the vscode-js-debug server with their own copies of the code to:

  • find a free port;
  • start the adapter process;
  • wait for its listening <host>:<port> announcement;
  • terminate it once the launch's debug targets ended.

This moves that code into a package private DebugAdapter class without functional changes. It is split out of #2319 so that the functional changes there (failing the launch when the adapter exits, times out or is canceled) can be reviewed on their own.

The delegates keep their differences:

  • launch passes Eclipse's environment and binds 127.0.0.1, logs the adapter's stderr, waits up to 10 s for the announcement and keeps its handshake watchdog;
  • attach waits about 3 s and connects to ::1. The old loop condition Duration.compareTo(...) < 3 only ended during the 4th second.

The only differences in attach are in its wait for the announcement:

  • it now uses launch's parsing, which waits for the <host>:<port> part instead of any chunk containing listening in any case;
  • it stops waiting when the thread is interrupted, instead of ignoring the interrupt.

TestDebug passes locally. No test covers attach.

The launch and attach delegates both started the vscode-js-debug server
with their own copies of the code to find a free port, wait for its
listening announcement and terminate it with the launch. Move that into
a package private DebugAdapter class, keeping the delegates' behaviour.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)
}
int port = DebugAdapter.findFreePort();
DebugAdapter adapter = DebugAdapter.start(launch,
new String[] { runtimeExecutable.getAbsolutePath(), file.getAbsolutePath(), Integer.toString(port) },
@akurtakov
akurtakov merged commit ef47133 into eclipse-wildwebdeveloper:master Dec 3, 2026
9 checks passed
@akurtakov
akurtakov deleted the debug-adapter-class branch December 3, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants