rcarriga / cmp-dap

nvim-cmp source for nvim-dap REPL and nvim-dap-ui buffers
MIT License
147 stars 9 forks source link

dap-repl buffer does not automatically close #7

Open dohmjan opened 1 year ago

dohmjan commented 1 year ago

Hello! I am using nvim-dap with your nvim-dap-ui and lately also tried cmp-dap. I really like it, thank you!

Without cmp-dap, the repl buffer automatically closes when toggling/closing the dap-ui. The corresponding issue was raised here. Your workaround in this comment and your PR in nvim-dap both worked. Now, after I included cmp-dap, the issue reappears. Could you imagine whether this is due to cmp-dap?

rcarriga commented 1 year ago

By not closed do you mean it is still listed (i.e. appears in :ls)?

There's nothing in cmp-dap that would be do that, but perhaps nvim-cmp is doing something? I don't experience any issue with it however

jaghaimo commented 1 year ago

Yes. It doesn't exist until I select something from autocompletion in repl, then: image

Finished the session and it's still there.

oshevtsov commented 1 year ago

I encountered the same behavior and could not find a quick fix. The temporary workaround I am using at the moment is to disable cmp-dap for [dap-repl] buffers (comment out "dap-repl" when setting up require("cmp").setup.filetype(...)) and rely on nvim-dap's completion suggestion via <C-x><C-o> (built-in omnifunc implementation).

EasonMo commented 1 week ago

@dohmjan @oshevtsov @jaghaimo Hi, I have got a solution to hide dap-repl buffer, not close. Because this buffer shoud be reuse by the next dap session. It can be checked at my config files MozyVim.

local dap = require("dap")
local function clear_dap_ui()
  local bufs = utils.find_buffers_by_filetype("dap-repl")
  for _, buf in ipairs(bufs) do
    vim.bo[buf].buflisted = false
  end
end
dap.listeners.before.event_terminated["dapui_config"] = function()
  clear_dap_ui()
end
dap.listeners.after.disconnect["dapui_config"] = function()
  clear_dap_ui()
end