rcarriga / cmp-dap

nvim-cmp source for nvim-dap REPL and nvim-dap-ui buffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using custom repl commands

carschandler opened this issue · comments

The nvim-dap REPL can be customized to use custom commands using the following syntax:

local repl = require('dap.repl')
repl.commands = vim.tbl_extend('force', repl.commands, {
  custom_commands = {
    ['.restart'] = function()
      dap.restart()
      repl.open()
      vim.cmd.wincmd('j')
    end,
    ['.clear'] = repl.clear()
  },
})

When using these custom commands alongside cmp-dap, an error is thrown:

Error detected while processing TextChangedI Autocommands for "*":
Error executing lua callback: 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'
        ...chan/.local/share/nvim/lazy/cmp-dap/lua/cmp_dap/init.lua:88: in function 'complete'
        .../chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:334: in function 'complete'
        /home/chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:299: in function 'complete'
        /home/chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:169: in function 'callback'
        /home/chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:229: in function 'autoindent'
        /home/chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:161: in function 'on_change'
        /home/chan/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:338: in function 'callback'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function 'emit'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:22>