rcarriga / nvim-dap-ui

A UI for nvim-dap
MIT License
2.64k stars 97 forks source link

"Failed to run `config` for nvim-dap" in latest update #360

Closed al1-ce closed 5 months ago

al1-ce commented 5 months ago
Failed to run `config` for nvim-dap

....local/share/nvim/lazy/nvim-dap-ui/lua/dapui/logging.lua:42: attempt to call field 'iter' (a nil value)

# stacktrace:
  - .config/nvim/lua/plugins/dap.lua:111 _in_ **config**
  - .config/nvim/lua/config/lazy.lua:16
  - .config/nvim/lua/utils/loader.lua:2 _in_ **load**
  - .config/nvim/init.lua:7
Config ```lua return { { 'mfussenegger/nvim-dap', dependencies = { 'rcarriga/nvim-dap-ui', 'nvim-neotest/nvim-nio', }, config = function() -- █▀▄ ▄▀█ █▀█ -- █▄▀ █▀█ █▀▀ local dap = require('dap') dap.adapters.lldb = function(cb, config) local adapter = dap.adapters.cpp if config.request == 'attach' and config.program then local terminal = dap.defaults[config.type].external_terminal local full_args = {} vim.list_extend(full_args, terminal.args or {}) table.insert(full_args, config.program) vim.list_extend(full_args, config.args or {}) local opts = { args = full_args, detached = true } local handle local pid_or_err handle, pid_or_err = vim.loop.spawn(terminal.command, opts, function(code) handle:close() if code ~= 0 then print('Terminal process exited', code, 'running', terminal.command, vim.inspect(full_args)) end end) if not handle then print('Could not launch process', terminal.command) else print('Launched external terminal', pid_or_err) while not config.pid do -- Adding a timeout or something might make sensedo config.pid = tonumber(vim.fn.system({ 'pgrep', '-P', pid_or_err })) end print('Launched', config.program, 'within terminal with PID', config.pid) config.program = nil end end cb(adapter) end dap.adapters.cpp = { type = 'executable', command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path name = 'lldb', -- env = { -- LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "NO" -- }, } dap.adapters.d = dap.adapters.cpp dap.adapters.c = dap.adapters.cpp -- dap.defaults.fallback.force_external_terminal = true dap.defaults.fallback.external_terminal = { -- dap.defaults.cpp.external_terminal = { -- command = "/usr/bin/alacritty", -- args = {'-e', '--hold'} command = "/usr/bin/kitty", args = { '--hold' } } dap.defaults.d.external_terminal = dap.defaults.fallback.external_terminal dap.defaults.cpp.external_terminal = dap.defaults.fallback.external_terminal dap.defaults.c.external_terminal = dap.defaults.fallback.external_terminal local function split(inputstr, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do table.insert(t, str) end return t end dap.configurations.cpp = { { name = 'Launch', -- type = 'gdb', type = 'lldb', -- request = 'attach', request = 'launch', program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = '${workspaceFolder}', stopOnEntry = false, -- args = {}, args = function() return split(vim.fn.input('Arguments (separated by $!): '), "$!") end, -- runInTerminal = true -- console = "externalTerminal", -- externalTerminal = true, } } dap.configurations.d = dap.configurations.cpp dap.configurations.c = dap.configurations.cpp vim.api.nvim_create_user_command('DapBreak', function() vim.cmd("DapToggleBreakpoint") end, {}) -- █▀▄ ▄▀█ █▀█ █ █ █ -- █▄▀ █▀█ █▀▀ █▄█ █ local dapui = require("dapui") ---@diagnostic disable-next-line: missing-fields dapui.setup({ layouts = { { elements = { -- { id = "scopes", size = 2 }, "breakpoints", "watches", -- "stacks", "scopes", -- "repl" }, size = 25, position = "left" } }, controls = { -- Requires Neovim nightly (or 0.8 when released) enabled = true, -- Display controls in this element element = "breakpoints", icons = { pause = "", play = "", step_into = "", step_over = "", step_out = "", step_back = "", run_last = "", terminate = "", }, }, }) dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end dap.listeners.after.event_breakpoint["dapui_config"] = function() dapui.open() end -- Next two causes some trouble, might turn them back on later dap.listeners.before.event_terminated["dapui_config"] = function() -- dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() -- dapui.close() end vim.api.nvim_create_user_command('DapUI', function() dapui.toggle() end, {}) end } } ```
jhonnyV-V commented 5 months ago

I am facing the same issue, the error is the same, I use Neovim v0.9.5, I use Linux Mint

SavingHeaume commented 5 months ago

I have the same issue on Win11, arch doesn't

al1-ce commented 5 months ago

I have the same issue on Win11, arch doesn't

I'm on arch actually

qbnil commented 5 months ago

Getting the same issue on Windows11

abdellatif-temsamani commented 5 months ago

getting the same issue on arch linux

juster-0 commented 5 months ago

You can temporarily move to previous commit 5934302d63d1ede12c0b22b6f23518bb183fc972. In that commits the plugin works fine for me.

abdellatif-temsamani commented 5 months ago

thanks