Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using vscode-js-debug debug adapter fails due to unimplemented startDebugging reverse request #11906

Open
chaorace opened this issue Oct 16, 2024 · 0 comments
Labels
C-bug Category: This is a bug

Comments

@chaorace
Copy link

chaorace commented Oct 16, 2024

Summary

This is something of a continuation of #4214

I am attempting to use the vscode-js-debug debugger adapter to debug typescript applications within Helix. It became independently useable by compliant editors starting in September 2023: microsoft/vscode-js-debug#926

Briefly after launching a debug session, the adapter will send a startDebugging command to Helix. This is not currently handled by Helix and after this point the editor and adapter are effectively placed into an invalid state where debugger related Helix commands are nonfunctional.

Reproduction Steps

languages.toml
[[language]]
language-servers = ["typescript-language-server"]
name = "typescript"
roots = ["package.json"]

[language.debugger]
args = ["/tmp/js-debug-dap/src/dapDebugServer.js"]
command = "node"
name = "vscode-js-debug"
port-arg = "{} 127.0.0.1"
transport = "tcp"

[[language.debugger.templates]]
name = "Launch Node Script"
request = "launch"
[[language.debugger.templates.completion]]
completion = "filename"
name = "main"

[language.debugger.templates.args]
address = "127.0.0.1"
program = "{0}"
type = "pwa-node"

I tried this:

  1. echo 'console.debug("hello world")' > /tmp/index.ts
  2. wget 'https://github.com/microsoft/vscode-js-debug/releases/download/v1.94.0/js-debug-dap-v1.94.0.tar.gz' -O /tmp/js-debug-dap.tar.gz
  3. tar -xvzf /tmp/js-debug-dap.tar.gz
  4. Apply above languages.toml configuration to ~/.config/helix/languages.toml
  5. hx /tmp/index.ts
  6. <space>Gbl<return>index.ts<return><esc>

I expected this to happen:
Helix should properly reflect the state of the debugger and correctly pass along debugger control commands such as :dap_next.

Instead, this happened:
Helix does not recognize that the debugger is paused and waiting for remote control. Helix commands associated with debugging do not function due to the editor/adaptor state mismatch.

Helix log

~/.cache/helix/helix.log
2024-10-16T16:37:21.857 helix_dap::transport [INFO] -> DAP {"type":"request","seq":0,"command":"initialize","arguments":{"adapterID":"vscode-js-debug","clientID":"hx","clientName":"helix","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsInvalidatedEvent":false,"supportsMemoryReferences":false,"supportsProgressReporting":false,"supportsRunInTerminalRequest":true,"supportsVariablePaging":false,"supportsVariableType":true}}
2024-10-16T16:37:21.860 helix_dap::transport [INFO] <- DAP {"seq":1,"type":"response","request_seq":0,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"supportsReadMemoryRequest":true,"supportsWriteMemoryRequest":true,"exceptionBreakpointFilters":[{"filter":"all","label":"Caught Exceptions","default":false,"supportsCondition":true,"description":"Breaks on all throw errors, even if they're caught later.","conditionDescription":"error.name == \"MyError\""},{"filter":"uncaught","label":"Uncaught Exceptions","default":false,"supportsCondition":true,"description":"Breaks only on errors or promise rejections that are not handled.","conditionDescription":"error.name == \"MyError\""}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":true,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":true,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true,"supportsExceptionFilterOptions":true,"supportsEvaluationOptions":false,"supportsDebuggerProperties":false,"supportsSetSymbolOptions":false}}
2024-10-16T16:37:21.860 helix_dap::transport [INFO] <- DAP success in response to 0
2024-10-16T16:37:21.860 helix_dap::transport [INFO] -> DAP {"type":"request","seq":1,"command":"launch","arguments":{"address":"127.0.0.1","cwd":"/tmp/foo","program":"/tmp/foo/index.ts","type":"pwa-node"}}
2024-10-16T16:37:21.860 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:21.860 helix_dap::transport [INFO] <- DAP {"seq":2,"type":"event","event":"initialized","body":{}}
2024-10-16T16:37:21.860 helix_dap::transport [INFO] <- DAP event Initialized(Some(DebuggerCapabilities { supports_configuration_done_request: None, supports_function_breakpoints: None, supports_conditional_breakpoints: None, supports_hit_conditional_breakpoints: None, supports_evaluate_for_hovers: None, supports_step_back: None, supports_set_variable: None, supports_restart_frame: None, supports_goto_targets_request: None, supports_step_in_targets_request: None, supports_completions_request: None, supports_modules_request: None, supports_restart_request: None, supports_exception_options: None, supports_value_formatting_options: None, supports_exception_info_request: None, support_terminate_debuggee: None, support_suspend_debuggee: None, supports_delayed_stack_trace_loading: None, supports_loaded_sources_request: None, supports_log_points: None, supports_terminate_threads_request: None, supports_set_expression: None, supports_terminate_request: None, supports_data_breakpoints: None, supports_read_memory_request: None, supports_write_memory_request: None, supports_disassemble_request: None, supports_cancel_request: None, supports_breakpoint_locations_request: None, supports_clipboard_context: None, supports_stepping_granularity: None, supports_instruction_breakpoints: None, supports_exception_filter_options: None, exception_breakpoint_filters: None, completion_trigger_characters: None, additional_module_columns: None, supported_checksum_algorithms: None }))
2024-10-16T16:37:21.860 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Initialized(Some(DebuggerCapabilities { supports_configuration_done_request: None, supports_function_breakpoints: None, supports_conditional_breakpoints: None, supports_hit_conditional_breakpoints: None, supports_evaluate_for_hovers: None, supports_step_back: None, supports_set_variable: None, supports_restart_frame: None, supports_goto_targets_request: None, supports_step_in_targets_request: None, supports_completions_request: None, supports_modules_request: None, supports_restart_request: None, supports_exception_options: None, supports_value_formatting_options: None, supports_exception_info_request: None, support_terminate_debuggee: None, support_suspend_debuggee: None, supports_delayed_stack_trace_loading: None, supports_loaded_sources_request: None, supports_log_points: None, supports_terminate_threads_request: None, supports_set_expression: None, supports_terminate_request: None, supports_data_breakpoints: None, supports_read_memory_request: None, supports_write_memory_request: None, supports_disassemble_request: None, supports_cancel_request: None, supports_breakpoint_locations_request: None, supports_clipboard_context: None, supports_stepping_granularity: None, supports_instruction_breakpoints: None, supports_exception_filter_options: None, exception_breakpoint_filters: None, completion_trigger_characters: None, additional_module_columns: None, supported_checksum_algorithms: None }))))
2024-10-16T16:37:21.861 helix_dap::transport [INFO] -> DAP {"type":"request","seq":2,"command":"setBreakpoints","arguments":{"breakpoints":[{"line":1}],"source":{"path":"/tmp/foo/index.ts"},"sourceModified":false}}
2024-10-16T16:37:21.901 helix_dap::transport [INFO] <- DAP {"seq":3,"type":"response","request_seq":2,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"breakpoint.provisionalBreakpoint"}]}}
2024-10-16T16:37:21.901 helix_dap::transport [INFO] <- DAP success in response to 2
2024-10-16T16:37:21.901 helix_dap::transport [INFO] -> DAP {"type":"request","seq":3,"command":"configurationDone","arguments":null}
2024-10-16T16:37:21.942 helix_dap::transport [INFO] <- DAP {"seq":4,"type":"response","request_seq":3,"command":"configurationDone","success":true,"body":{}}
2024-10-16T16:37:21.942 helix_dap::transport [INFO] <- DAP success in response to 3
2024-10-16T16:37:21.942 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP {"seq":5,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-node","request":"launch","os":"linux x64","nodeVersion":"v20.17.0","adapterVersion":"1.93.0","parameters":"{\"type\":\"pwa-node\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":false,\"outputCapture\":\"console\",\"timeout\":10000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[\"<string>\"],\"smartStep\":true,\"sourceMaps\":true,\"sourceMapRenames\":true,\"pauseForSourceMap\":false,\"resolveSourceMapLocations\":null,\"outFiles\":[\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://@?:*/?:*/*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"enableDWARF\":true,\"__workspaceFolder\":\"<string>\",\"__breakOnConditionalError\":false,\"cwd\":\"<string>\",\"env\":{},\"envFile\":null,\"localRoot\":null,\"remoteRoot\":null,\"autoAttachChildProcesses\":true,\"runtimeSourcemapPausePatterns\":[],\"program\":\"<string>\",\"stopOnEntry\":false,\"console\":\"internalConsole\",\"restart\":false,\"args\":[],\"runtimeExecutable\":\"node\",\"runtimeVersion\":\"default\",\"runtimeArgs\":[],\"profileStartup\":false,\"attachSimplePort\":null,\"experimentalNetworking\":\"auto\",\"killBehavior\":\"forceful\",\"address\":\"<string>\"}"}}}
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP event Output(Output { output: "js-debug/launch", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"adapterVersion": String("1.93.0"), "nodeVersion": String("v20.17.0"), "os": String("linux x64"), "parameters": String("{\"type\":\"pwa-node\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":false,\"outputCapture\":\"console\",\"timeout\":10000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[\"<string>\"],\"smartStep\":true,\"sourceMaps\":true,\"sourceMapRenames\":true,\"pauseForSourceMap\":false,\"resolveSourceMapLocations\":null,\"outFiles\":[\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://@?:*/?:*/*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"enableDWARF\":true,\"__workspaceFolder\":\"<string>\",\"__breakOnConditionalError\":false,\"cwd\":\"<string>\",\"env\":{},\"envFile\":null,\"localRoot\":null,\"remoteRoot\":null,\"autoAttachChildProcesses\":true,\"runtimeSourcemapPausePatterns\":[],\"program\":\"<string>\",\"stopOnEntry\":false,\"console\":\"internalConsole\",\"restart\":false,\"args\":[],\"runtimeExecutable\":\"node\",\"runtimeVersion\":\"default\",\"runtimeArgs\":[],\"profileStartup\":false,\"attachSimplePort\":null,\"experimentalNetworking\":\"auto\",\"killBehavior\":\"forceful\",\"address\":\"<string>\"}"), "request": String("launch"), "type": String("pwa-node")}) })
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP {"seq":6,"type":"event","event":"output","body":{"category":"console","output":"node ./index.ts\n"}}
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP event Output(Output { output: "node ./index.ts\n", category: Some("console"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP {"seq":7,"type":"response","request_seq":1,"command":"launch","success":true,"body":{}}
2024-10-16T16:37:21.983 helix_dap::transport [INFO] <- DAP success in response to 1
2024-10-16T16:37:21.983 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:21.983 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Output(Output { output: "js-debug/launch", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"adapterVersion": String("1.93.0"), "nodeVersion": String("v20.17.0"), "os": String("linux x64"), "parameters": String("{\"type\":\"pwa-node\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":false,\"outputCapture\":\"console\",\"timeout\":10000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[\"<string>\"],\"smartStep\":true,\"sourceMaps\":true,\"sourceMapRenames\":true,\"pauseForSourceMap\":false,\"resolveSourceMapLocations\":null,\"outFiles\":[\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://@?:*/?:*/*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"enableDWARF\":true,\"__workspaceFolder\":\"<string>\",\"__breakOnConditionalError\":false,\"cwd\":\"<string>\",\"env\":{},\"envFile\":null,\"localRoot\":null,\"remoteRoot\":null,\"autoAttachChildProcesses\":true,\"runtimeSourcemapPausePatterns\":[],\"program\":\"<string>\",\"stopOnEntry\":false,\"console\":\"internalConsole\",\"restart\":false,\"args\":[],\"runtimeExecutable\":\"node\",\"runtimeVersion\":\"default\",\"runtimeArgs\":[],\"profileStartup\":false,\"attachSimplePort\":null,\"experimentalNetworking\":\"auto\",\"killBehavior\":\"forceful\",\"address\":\"<string>\"}"), "request": String("launch"), "type": String("pwa-node")}) })))
2024-10-16T16:37:21.983 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Output(Output { output: "node ./index.ts\n", category: Some("console"), group: None, line: None, column: None, variables_reference: None, source: None, data: None })))
2024-10-16T16:37:21.983 helix_view::handlers::dap [INFO] node ./index.ts

2024-10-16T16:37:21.983 helix_view::editor [DEBUG] editor status: Debug (console): node ./index.ts

2024-10-16T16:37:21.983 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:22.063 helix_dap::transport [INFO] <- DAP {"seq":8,"type":"request","command":"startDebugging","arguments":{"request":"launch","configuration":{"type":"pwa-node","name":"index.ts [1614858]","__pendingTargetId":"d54718035a0725807641d4ef"}}}
2024-10-16T16:37:22.063 helix_dap::transport [INFO] <- DAP request startDebugging #8
2024-10-16T16:37:22.063 helix_term::application [DEBUG] received editor event: DebuggerEvent(Request(Request { back_ch: None, seq: 8, command: "startDebugging", arguments: Some(Object {"configuration": Object {"__pendingTargetId": String("d54718035a0725807641d4ef"), "name": String("index.ts [1614858]"), "type": String("pwa-node")}, "request": String("launch")}) }))
2024-10-16T16:37:22.063 helix_view::handlers::dap [ERROR] DAP reverse request not implemented: Request { back_ch: None, seq: 8, command: "startDebugging", arguments: Some(Object {"configuration": Object {"__pendingTargetId": String("d54718035a0725807641d4ef"), "name": String("index.ts [1614858]"), "type": String("pwa-node")}, "request": String("launch")}) }
2024-10-16T16:37:22.063 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:23.844 helix_view::editor [DEBUG] editor error: Currently active thread is not stopped. Switch the thread.
2024-10-16T16:37:23.844 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:24.094 helix_term::application [DEBUG] received editor event: IdleTimer
2024-10-16T16:37:26.972 helix_dap::transport [INFO] <- DAP {"seq":9,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"launch":{"operation":"launch","totalTime":106.3,"max":106.3,"avg":106.3,"stddev":null,"count":1,"failed":0},"!launch.errors":[],"launch.errors":[]}}}
2024-10-16T16:37:26.972 helix_dap::transport [INFO] <- DAP event Output(Output { output: "js-debug/dap/operation", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"!launch.errors": Array [], "errors": Array [], "launch": Object {"avg": Number(106.3), "count": Number(1), "failed": Number(0), "max": Number(106.3), "operation": String("launch"), "stddev": Null, "totalTime": Number(106.3)}, "launch.errors": Array []}) })
2024-10-16T16:37:26.972 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Output(Output { output: "js-debug/dap/operation", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"!launch.errors": Array [], "errors": Array [], "launch": Object {"avg": Number(106.3), "count": Number(1), "failed": Number(0), "max": Number(106.3), "operation": String("launch"), "stddev": Null, "totalTime": Number(106.3)}, "launch.errors": Array []}) })))
2024-10-16T16:37:27.056 helix_dap::transport [INFO] <- DAP {"seq":10,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/cdp/operation","data":{"errors":[],"Target.targetCreated":{"operation":"Target.targetCreated","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!Target.targetCreated.errors":[],"Target.targetCreated.errors":[]}}}
2024-10-16T16:37:27.056 helix_dap::transport [INFO] <- DAP event Output(Output { output: "js-debug/cdp/operation", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"!Target.targetCreated.errors": Array [], "Target.targetCreated": Object {"avg": Number(0.2), "count": Number(1), "failed": Number(0), "max": Number(0.2), "operation": String("Target.targetCreated"), "stddev": Null, "totalTime": Number(0.2)}, "Target.targetCreated.errors": Array [], "errors": Array []}) })
2024-10-16T16:37:27.056 helix_term::application [DEBUG] received editor event: DebuggerEvent(Event(Output(Output { output: "js-debug/cdp/operation", category: Some("telemetry"), group: None, line: None, column: None, variables_reference: None, source: None, data: Some(Object {"!Target.targetCreated.errors": Array [], "Target.targetCreated": Object {"avg": Number(0.2), "count": Number(1), "failed": Number(0), "max": Number(0.2), "operation": String("Target.targetCreated"), "stddev": Null, "totalTime": Number(0.2)}, "Target.targetCreated.errors": Array [], "errors": Array []}) })))
2024-10-16T16:37:27.693 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-10-16T16:37:27.944 helix_term::application [DEBUG] received editor event: IdleTimer

Platform

Linux

Terminal Emulator

wezterm c26b6a3

Installation Method

nixpkgs

Helix Version

helix 24.7 (079f544)

@chaorace chaorace added the C-bug Category: This is a bug label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

1 participant