Skip to content

Commit

Permalink
bugfix(python): use virtual environment if activated (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter authored Dec 19, 2022
1 parent 2c97ca2 commit 4ec6bce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/mason-nvim-dap/mappings/configurations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ M.bash = {
},
}

local venv_path = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_PREFIX')
M.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 = 'Python: Launch file',
program = '${file}', -- This configuration will launch the current file if used.
pythonPath = venv_path and (venv_path .. '/bin/python') or nil,
},
}

Expand Down

0 comments on commit 4ec6bce

Please sign in to comment.