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

Invalid Window ID for DAP_REPL #5

Closed
HudsonMC16 opened this issue Apr 16, 2021 · 3 comments
Closed

Invalid Window ID for DAP_REPL #5

HudsonMC16 opened this issue Apr 16, 2021 · 3 comments

Comments

@HudsonMC16
Copy link

HudsonMC16 commented Apr 16, 2021

Here is the relevant details on my setup:

DAP config in init.lua:

local dap = require('dap')
dap.adapters.python = {
  type = 'executable';
  command = os.getenv('USERPROFILE') .. '\\AppData\\Local\\nvim\\debugpy\\Scripts\\python.exe';
  args = { '-m', 'debugpy.adapter' };
}
dap.configurations.python = {
  {
    type = 'python';
    request = 'launch';
    name = "Launch file";
    program = "${file}";
    pythonPath = vim.fn.getcwd() .. '\\.venv\\Scripts\\python.exe';
    console = 'integratedTerminal';
  },
}
require('dapui').setup()

Output of :version:

NVIM v0.5.0-dev+1233-g82ac44d01
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -ID:/a/neovim/neovim/build/config -ID:/a/neovim/neovim/src -IC:/projects/nvim-deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include
Compiled by runneradmin@fv-az152-151

Features: -acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM\sysinit.vim"
  fall-back for $VIM: "C:/Program Files/nvim/share/nvim"

Run :checkhealth for more info

starting the DAP with :lua require('dap').continue() works wonderfully, and all the windows are properly setup. The DAP repl works great and as expected also. When .exit is executed at the repl, though, things break down. I added print(vim.inspect(sidebar_windows)) and print(vim.inspect(tray_windows)) here and here, and here is the output when .exit is run at the repl:

{
  [1003] = {
    float_defaults = {
      enter = true,
      height = 20,
      width = 80
    },
    name = "DAP REPL",
    on_close = <function 1>,
    on_open = <function 2>,
    setup = <function 3>
  }
}
Error executing vim.schedule lua callback: ...ata\Local\nvim\plugged\nvim-dap-ui\lua\dapui\windows.lua:47: Invalid window id: 1003
{
  [1003] = {
    float_defaults = {
      enter = true,
      height = 20,
      width = 80
    },
    name = "DAP REPL",
    on_close = <function 1>,
    on_open = <function 2>,
    setup = <function 3>
  }
}
Error executing vim.schedule lua callback: ...ata\Local\nvim\plugged\nvim-dap-ui\lua\dapui\windows.lua:47: Invalid window id: 1003
Press ENTER or type command to continue

I haven't dug into it too much further than that, but maybe can over the weekend. I'm no lua pro, though. I figured I'd get it in front of you first. Few things I'm confused about:

  1. 1003 is showing up in both the sidebar and tray window tables
  2. None of the other windows are showing up in either table
  3. 1003 appears to be a valid window id, so I'm not sure why nvim is complaining about an invalid window id.

I know windows is probably not your target platform, so let me know if I need to do any more testing to help with this.

And forgot to add: thanks so much for putting this together. Can't wait to switch to this from pdb and vimspector. I really like the UI you've put together.

@rcarriga
Copy link
Owner

Thanks for the great report and the feedback, great to hear from people using the project!

Don't worry this is just a simple fix, I've never used .exit before so I hadn't encountered it. It closes the REPL before nvim-dap-ui does and so it tries to close a window that doesn't exist anymore (hence the invalid ID).

@HudsonMC16
Copy link
Author

@rcarriga ah interesting. So what's the intended workflow with this? Maybe I'm misunderstanding. If you're not using .exit, how do you exit or restart the debugger?

@rcarriga
Copy link
Owner

Oh that's a perfectly valid workflow, it's just that I do the vast majority of my debugging with vim-ultest and so I just follow the programs to completion as they are tests. I don't really have the need to exit from the program before it completes.

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

No branches or pull requests

2 participants