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 is a bit messy with vscode-cpptools. #1037

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) Create a functions called some_function(). 2) Open the REPL window, switch to it and enter insert mode. 3) Type -exec b some: repl 4) Press <C-x><C-o> to trigger autocompletion: completion

Expected Result

The completed suggestion should overwrite the entire line: -exec b some_function()

Actual Result

The completed suggestion is appended to what was typed before triggering the completion: -exec b -exec b some_function()

mfussenegger commented 10 months ago

Can you try with https://github.com/mfussenegger/nvim-dap/pull/1038 ? It should fix this.

Alexey104 commented 10 months ago

Confirm, this fix works. Thank you so much!