2

I'm trying to setup Flask debugging in NVIM.

When I debug a simple file and use break point (F9) vimspector works as charm.

a = 5
b = 10

def misko(a, b):
    c = 2
    a = c * a
    return a + b

if __name__ == "__main__":
    misko(a, b)

However, my usecase it to debug Flask app.

Vimspector simply does not stop at breakpoint.

{
  "configurations": {
    "env": {
      "ENV": "development",
      ...
    },
    "python: Launch at macbook": {
      "adapter": "debugpy",
      "configuration": {
        "name": "python: Launch",
        "type": "python",
        "request": "launch",
        "cwd": "${workspaceRoot}",
        "python": "${workspaceRoot}/venv-tmp/bin/python",
        "stopOnEntry": false,
        "console": "integratedTerminal",
        "program": "${workspaceRoot}/app.py"
      }
    }
  }
}
davidism
  • 121,510
  • 29
  • 395
  • 339
user2156115
  • 1,169
  • 4
  • 17
  • 30
  • Have you found the reasons? I have similar issue when I run subrpocess with python script from within a master python script. Breakpoint only works for master script. – Roman Malashin Jul 14 '22 at 17:11

1 Answers1

0

Previously, Vimspector did not support multiprocessing. That is if the python process being debugged spawned child processes (which is common with HTTP server frameworks like flask, Django, etc.), then it would just sort of silently not work. This was a limitation of the Debug Adapter Protocol.

However, the happy news is that Vimspector now fully supports that: https://github.com/puremourning/vimspector#child-sessions

So, assuming that flask was using multiprocessing, then it should work now.

If not, then please see CONTRIBUTING.md on how to provide an issue report and/or get help. Your .vimspector.json looks fine on the surface.

puremourning
  • 121
  • 3