mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suppress "Debug adapter didn't respond" during `Session:initialize` if we received progress events

vogelsgesang opened this issue · comments

Problem Statement

I am using lldb to debug some C++ programs. Loading the program and its symbol tables can take a while.
Therefore, I configured nvim-dap to display progress notifications, i.e. event_progress{Start,Update,End} through this snippet.

This works sufficiently well, but unfortunately still displays the "Debug adapter didn't respond.", although the debug adapter did in fact respond. The following video exemplifies the problem:

ScreenRecording.mov

Although lldb did report that it is currently loading symbol tables, nvim-dap claims that lldb didn't respond.

Judging from the source code of Session::initialize, I don't see a way how I could suppress this message from an extension to nvim-dap.

Ideas or possible solutions

I see two potential solutions:

  1. Provide a way to tell nvim-dap to defer the "Debug adapter didn't respond." message by another 4 seconds. I would call this Session:deferStartupTimeout from my extension whenever I receive a progress notification.
  2. Implement support for progress notifications directly inside nvim-dap

You can set the timeout as part of the adapter definition via initialize_timeout_sec.

local myadapter = {
  type = 'executable',
  command = '...',
  options = {
    initialize_timeout_sec = 10,
  }

See 3b3027e

There's currently no way to extend/defer the active timeout once the initialize request is pending.

I could imagine just resetting the timeout after any response - the main intention behind the timeout was to give users some feedback - there are unfortunately some adapters who just crash or never respond if they receive some payload they cannot handle on a launch request

I might revisit this at a later point, but for now I am closing this. Increasing the timeout value should be good enough in most cases.