Skip to content

How to configure nvim-dap-python to pass a different working directory #919

Closed Answered by robertsawko
robertsawko asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for this! I actually stopped using nvim-dap-python, as the wiki example was sufficient for what I needed. I currently use the following .nvimrc that sits at the root directory of my project:

lua << EOF
local dap = require('dap')
dap.adapters.python = {
  type = 'executable';
  command = os.getenv("VIRTUAL_ENV") .. "/bin/python";
  args = { '-m', 'debugpy.adapter' };
}


dap.configurations.python = {
  {
    -- The first three options are required by nvim-dap
    type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
    request = 'launch';
    name = "Launch file";
    cwd = "/path/to/repository/root/dir";  --python is executed from …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cristobaltapia
Comment options

Answer selected by robertsawko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants