Skip to content

runInTerminal reverse-request missing cwd key #251

Open

Description

According to the DAP specification, the cwd key in the runInTerminal request is mandatory.

https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_RunInTerminal

however, the java debug server sends the request without this key:

2018-12-20 00:03:04,861 - DEBUG - Message received: {'command': 'runInTerminal', 'arguments': {'kind': 'integrated', 'title': 'Java Debug Console', 'args': ['/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java', '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:53159', '-Dfile.encoding=UTF-8', '-cp', '/Users/ben/.vim/bundle/vimspector/support/test/java/test_project/target/classes', 'com.vimspector.test.TestApplication', 'hello', 'world!']}, 'seq': 2, 'type': 'request'}

of course, clients could work around this, but it would be nice for the server to include the required parameter.

Activity

  1. testforstephen commented on Feb 14, 2019

    @testforstephen
    Contributor

    Ben Jackson (@puremourning) Follow the code https://github.com/Microsoft/java-debug/blob/master/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchWithDebuggingDelegate.java#L75, actually the java debug server will send cwd key from launch.json to the client.

    How did you use java debug server? VS Code Debugger for Java extension or self implemented debugger?

  2. puremourning commented on Sep 30, 2020

    @puremourning
    Author

    Thanks

    the java debug server will send cwd key from launch.json to the client

    Is that a mandatory launch parameter ? The adapter seems to work fine without it and the docs for vscode suggest it's optional: "cwd - The working directory of the program. Defaults to ${workspaceFolder}."

    I guess the vscode-java plugin always sets it ? Is there a specification for the arguments accepted/required by this adapter when not using vscode-java ?

    How did you use java debug server? VS Code Debugger for Java extension or self implemented debugger?

    In Vimspector - another DAP client accessing java-debugger through eclipse.jdt.ls.

  3. github-actions commented on Nov 14, 2025

    @github-actions

    Hi Ben Jackson (@puremourning), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    • According to the DAP spec, the cwd field is mandatory on runInTerminal reverse-requests: https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_RunInTerminal

    • Update the Java Debug adapter to populate cwd when sending the request. In LaunchRequestHandler.java, locate where you build the RunInTerminalRequestArguments and change it from:

      new RunInTerminalRequestArguments(kind, title, /* no cwd */, args);

      to something like:

      String cwd = launchConfig.getCwd() != null
          ? launchConfig.getCwd()
          : System.getProperty("user.dir");
      new RunInTerminalRequestArguments(kind, title, cwd, args);
    • Similar high-confidence reference:
      • Unknown event "processid" (Unknown event "processid" #460): notes other DAP-spec mismatches in the Java Debug server, including runInTerminal details. Unknown event "processid" #460

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions