pocco81 / dap-buddy.nvim

🐞 Debug Adapter Protocol manager for Neovim
GNU General Public License v3.0
400 stars 48 forks source link

[Question] Python debugger doesn't work. #19

Closed TornaxO7 closed 3 years ago

TornaxO7 commented 3 years ago

Hello! I'm sorry, but I'm veeeery irritated how to setup this plugin.

If I start nvim-dap, then I'm getting the following error messages:

No configuration found for `python`. You need to add configs to `dap.configurations.python` (See `:h dap-configuration`)

Reproduction steps

Here are my settings: ~/.config/nvim/init.vim:

```vim call plug#begin('~/.vim/plugged') Plug 'mfussenegger/nvim-dap' Plug 'theHamsta/nvim-dap-virtual-text' Plug 'rcarriga/nvim-dap-ui' Plug 'Pocco81/DAPInstall.nvim' call plug#end() source ~/.config/nvim/plugins/dap.vim lua require("dapinstall") ```

~/.config/nvim/plugins/dap.vim:

```vim augroup NvimDap autocmd! au FileType dap-repl lua require('dap.ext.autocompl').attach() augroup END let g:my_dap_repl_is_open = v:false function OpenRepl() echo "called" " open repl if it isn't opened yet if !g:my_dap_repl_is_open lua require('dap').repl.open() let g:my_dap_repl_is_open = v:true endif lua require('dap').continue() endfunction nnoremap :call OpenRepl() nnoremap :lua require('dap').step_over() nnoremap :lua require('dap').step_into() nnoremap :lua require('dap').step_out() nnoremap :lua require('dap').toggle_breakpoint() nnoremap :lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) nnoremap :lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) lua require("dap_conf") ```

~/.config/nvim/lua/dap.lua:

```lua local dap = require('dap') local dap_ui = require('dapui') dap.set_log_level('TRACE') dap_ui.setup( { icons = { expanded = "⯆", collapsed = "⯈", circular = "↺" }, mappings = { expand = "", open = "o", remove = "d" }, sidebar = { elements = { -- You can change the order of elements in the sidebar "scopes", "stacks", "watches" }, width = 40, position = "left" -- Can be "left" or "right" }, tray = { elements = { "repl" }, height = 10, position = "bottom" -- Can be "bottom" or "top" }, floating = { max_height = nil, -- These can be integers or a float between 0 and 1. max_width = nil -- Floats will be treated as percentage of your screen. } }) vim.g.dap_virtual_text = true ```

~/.config/nvim/lua/dapinstall.lua

```lua local dap_install = require("dap-install") dap_install.setup({ installation_path = "~/Apps/nvim-dap/", verbosely_call_debuggers = false, }) dap_install.config("python_dbg", { adapters = { type = "executable", command = "python3", args = {"-m", "debugpy.adapter"} }, configurations = { { type = "python", request = "launch", name = "Launch file", program = "${file}", pythonPath = "python3" } } }) dap_install.config("php_dbg", {}) ```

I already did :DIInstall python_dbg but it still says that I can't use the python debugger.

TornaxO7 commented 3 years ago

I also noticed that my ~/Apps/nvim-dap/ directory is empty. Is that normal?

pocco81 commented 3 years ago

~ is a shortcut for $HOME, which is a system variable, and DAPInstall can't read system variables (although I think it might be possible through a luarock). If you want to specify the path to a directory under your $HOME then you could:

  1. just type it /home/pocco81/Apps/nvim-dap/
  2. Use nvim's vim api to fetch the $HOME var like so:
local dap_install = require("dap-install")

dap_install.setup({
    installation_path = vim.api.nvim_eval('$HOME') .. "Apps/nvim-dap/", -- this
    verbosely_call_debuggers = false,
})

I'm veeeery irritated how to setup this plugin.

Why? :(

TornaxO7 commented 3 years ago

Yeah it works now! Thank you :)

TornaxO7 commented 3 years ago

I'm veeeery irritated how to setup this plugin.

It was because it didn't work. Thank you for simplifying the debugging process with this plugin :)