mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.17k stars 180 forks source link

REPL autocompletion - some minor bugs still occur after merging #1038. #1039

Closed Alexey104 closed 10 months ago

Alexey104 commented 10 months ago

Debug adapter definition and debug configuration

local home=os.getenv( "HOME" )
local gdb_path = home .. "/.config/nvim/gdb/extension/debugAdapters/bin/OpenDebugAD7"

local dap = require('dap')

dap.adapters.cppdbg = {
  id = 'cppdbg',
  type = 'executable',
  command = gdb_path,
}

dap.configurations.cpp = {
  {
    name = "Launch file",
    type = "cppdbg",
    request = "launch",
    program = function()
      return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
    end,
    cwd = '${workspaceFolder}',
    stopAtEntry = true,
    setupCommands = {
        {
            text = '-enable-pretty-printing',
            description =  'enable pretty printing',
            ignoreFailures = false
        },
        {
            text = 'set follow-fork-mode parent',
            description =  'follow parent process',
            ignoreFailures = false
        },
        {
            text = 'set detach-on-fork off',
            description =  'disable detach on fork',
            ignoreFailures = false
        },
    },
  },
}

Debug adapter version

vscode-cpptools v1.17.5

Steps to Reproduce

1) In the REPL window type -exec i bre: repl 2) Press <C-x><C-o> to trigger autocompletion: completion 3) Press <CR> to confirm the suggestion: 2023-09-15_10-59

Expected Result

The completed command should be exec -i breakpoints.

Actual Result

An additional random(?) character is appended to the end of the command.

mfussenegger commented 10 months ago

What are your complete and completeopt settings? I'm not seeing any additional characters. -exec i bre completes to -exec i breakpoints for me.

Alexey104 commented 10 months ago

What are your complete and completeopt settings?

complete=.,w,b,u,t
completeopt=menu,preview

-exec i bre completes to -exec i breakpoints for me.

Yes, it completes correctly for me too, but after pressing Return a garbage character is appended at the end. I also see this behavior when setting breakpoints at some (but not all) functions.

mfussenegger commented 10 months ago

I tried it again with your options and it still works fine for me. Return doesn't append any garbage characters.

Alexey104 commented 10 months ago

Hmm... Maybe some of my other plugins causes this. When I have more time I'll try to disable everything besides nvim-dap and test. I'll report back if I find anything.

Alexey104 commented 10 months ago

Ok, Coc.nvim plugin was the culprit, specifically these lines:

if exists('*complete_info')
    inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
    inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif

Sorry for wasting your time, I should've checked with clean config right away before reporting a bug.