Skip to content

Commit

Permalink
fix: add cwd to dap-python launch configurations
Browse files Browse the repository at this point in the history
The `cwd` field was missing from the launch configurations in `dap-python.lua`, causing issues when launching files from different directories. This commit adds the `cwd` field to all launch configurations, setting it to the current working directory using `vim.fn.getcwd()`. This ensures that the debugger correctly finds the necessary files and dependencies.
  • Loading branch information
devxpain committed Nov 18, 2024
1 parent 3e3dd98 commit f1eeb1d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/dap-python.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ function M.setup(adapter_python_path, opts)
request = 'launch';
name = 'Launch file';
program = '${file}';
cwd = vim.fn.getcwd();
console = opts.console;
pythonPath = opts.pythonPath,
})
Expand All @@ -253,6 +254,7 @@ function M.setup(adapter_python_path, opts)
request = 'launch';
name = 'Launch file with arguments';
program = '${file}';
cwd = vim.fn.getcwd();
args = function()
local args_string = vim.fn.input('Arguments: ')
return vim.split(args_string, " +")
Expand All @@ -277,6 +279,7 @@ function M.setup(adapter_python_path, opts)
name = 'Run doctests in file',
module = 'doctest',
args = { "${file}" },
cwd = vim.fn.getcwd();
noDebug = true,
console = opts.console,
pythonPath = opts.pythonPath,
Expand Down

0 comments on commit f1eeb1d

Please sign in to comment.