Playdate Simulator debug adapter protocol does not support terminate request

Platform
macOS

Reproduction
This bug does not affect debugging in Nova, but it does have a minor affect on debugging in VS Code.

I am inspecting the messages between the client and the Playdate Simulator debugger using sudo tcpdump -i lo0 -A tcp port 55934 .

  1. Open a Playdate project
  2. Build the project
  3. Debug the game using the Playdate Simulator debugger
  4. Press the stop button in the client

Expected

  1. The client sends: { "command":"initialize", "type":"request" }
  2. The server responds with: { "command":"initialize", "type":"response", "success":true,", "supportsTerminateRequest":true }
  3. The client sends: { "type": "request", "command": "terminate" }
  4. The server responds with: { "type": "response", "command": "terminate", "success": true }

Actual

  1. The client sends: { "command":"initialize", "type":"request" }
  2. The server responds with: { "command":"initialize", "type":"response", "success":true,", "supportsTerminateRequest":true }
  3. The client sends: { "type": "request", "command": "terminate" }
  4. The server responds with: {"command":"terminate","message":"Unsupported method: terminate","type":"response","success":false}

I see that Nova sends a disconnect command instead of a terminate command. VS Code attempts to send a terminate command first and then a disconnect command second if the terminate fails as mentioned in this issue.

I was able to work around this issue and Playdate Simulator debug adapter protocol does not send success response to launch request by proxying messages to and from the Simulator: https://github.com/midouest/vscode-playdate-debug/blob/main/src/PlaydateDebugAdapterProxy.ts

Patching the supportsTerminateRequest property now causes VS Code to correctly terminate the debugger when the user clicks the stop button.

Thanks for the report! We'll look into this.

@midouest I've fixed the two issues you've reported with the Mac Simulator DAP support. I'm also adding DAP support to the Windows/Linux simulator and your extension seems the farthest along. :slight_smile: If I provided you documentation to improve your launch/attach requests would you be wiling to add it to your extension?

2 Likes

That's great to hear! I'd be happy to improve the launch/attach requests.