mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autocompletion does not work when configuring custom repl commands.

mosmuell opened this issue · comments

Debug adapter definition and debug configuration

I installed nvim-dap through packer.nvim.
I configured the custom repl commands as described in the wiki

local repl = require 'dap.repl'
repl.commands = vim.tbl_extend('force', repl.commands, {
    -- Add a new alias for the existing .exit command
    exit = {'exit', '.exit', '.bye'},
    -- Add your own commands; run `.echo hello world` to invoke
    -- this function with the text "hello world"
    custom_commands = {
        ['.echo'] = function(text)
            nvim_dap.repl.append(text)
        end,
        -- Hook up a new command to an existing dap function
        ['.restart'] = nvim_dap.restart,
    },
})

I configured autocompletion as described in the Wiki as well

vim.cmd [[
  augroup _nvim_dap_repl
    au FileType dap-repl lua require('dap.ext.autocompl').attach()
  augroup END
]]

Debug adapter version

No response

Steps to Reproduce

Upon opening dap-repl (e.g. :lua require'dap'.repl.toggle()) the autocompletion, triggered by . does not work and I get an error (see below).

Expected Result

Like without custom commands, I expect to get a dropdown list showing the possible commands, both in-built and custom commands.

Actual Result

Vim error

E5108: Error executing lua vim/shared.lua:0: s: expected string, got function
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'startswith'
        ...re/nvim/site/pack/packer/start/nvim-dap/lua/dap/repl.lua:360: in function <...re/nvim/site/pack/packer/start/nvim-dap/lua/dap/repl.lua:346>
Press ENTER or type command to continue

Thanks for pointing out, should be fixed with #549