mfussenegger / nvim-dap-python

An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attach using config.connect.host/port?

groner opened this issue · comments

I am trying to use a launch.json that has an attach config where the host/port are specified as subfields of a connect object in the configuration.

        {
            "name": "Attach to blah blah blah",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5678
            }
            // other fields elided
        }

AIUI this config is generated by vscode-python which seems to use this schema since microsoft/vscode-python#12446.

The following patch makes this config work.

--- lua/dap-python.lua
+++ lua/dap-python.lua
@@ -57,8 +57,8 @@ function M.setup(adapter_python_path, opts)
     if config.request == 'attach' then
       cb({
         type = 'server';
-        port = config.port or 0;
-        host = config.host or '127.0.0.1';
+        port = (config.connect or config).port or 0;
+        host = (config.connect or config).host or '127.0.0.1';
         enrich_config = enrich_config;
       })
     else