mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attempt to get length of local 'prev_line' (a nil value)

fgheng opened this issue · comments

commented

Debug adapter definition and debug configuration

Hello, I am using nvim-dap with dap-ui to debug python.

I have configured the adapters, python used debugpy and c++ used cppdbg. Using shortcut keys can execute DAP commands smoothly, but entering repl window will cause problems. As long as I enter any content, this error prompt will appear, just like the picture showes.

err

Debug adapter version

debugpy: 1.6.0

Steps to Reproduce

The function of DAP can be used normally through shortcut keys, like toggle_breakpoint, continue,
Problems only occur when entering repl window.

Expected Result

Do not prompt error messages

Actual Result

err

Are you by any chance connecting the REPL buffer to the LSP client? The error you're getting is from the LSP client.

If you're in the REPL buffer and run :lua =vim.lsp.buf_get_clients() what's the result?

(Also, the issue template is not just for decoration, please follow it next time)

commented

If you're in the REPL buffer and run :lua =vim.lsp.buf_get_clients() what's the result?

Ha, here is the output of the command, I think it is actually connected to lsp.

{lua =vim.lsp.buf_get_clients()
  [2] = {
    _on_attach = <function 1>,
    attached_buffers = {
      [4] = true
    },
    cancel_request = <function 2>,
    commands = {},
    config = {
      autostart = true,
      cmd = { "node", "/home/forever/.local/share/nvim/site/pack/packer/opt/copilot.lua/copilot/index.js" },
      flags = {},
      get_language_id = <function 3>,
      name = "copilot",
      on_attach = <function 4>,
      on_init = <function 5>,
      root_dir = "/home/forever/Downloads",
      settings = {},
      trace = "messages"
    },
    handlers = {},
    id = 2,
    initialized = true,
    is_stopped = <function 6>,
    messages = {
      messages = {},
      name = "copilot",
      progress = {},
      status = {}
    },
    name = "copilot",
    notify = <function 7>,
    offset_encoding = "utf-16",
    request = <function 8>,
    request_sync = <function 9>,
    requests = {},
    rpc = {
     handle = <userdata 1>,
      notify = <function 10>,
      pid = 986431,
      request = <function 11>
    },
    server_capabilities = {
      textDocumentSync = {
        change = 2,
        openClose = true
      },
      workspace = {
        workspaceFolders = {
          changeNotifications = true,
          supported = true
        }
      }
    },
    stop = <function 12>,
    supports_method = <function 13>,
    workspaceFolders = <1>{ {
        name = "/home/forever/Downloads",
        uri = "file:///home/forever/Downloads"
      } },
    workspace_folders = <table 1>,
    <metatable> = {
      __index = <function 14>
    }
  }
}

commented

It is caused by the plugin copilot, I commented copilot, all is ok.

thank you very much.

Looks like it's related to zbirenbaum/copilot.lua#16

commented

Yes, copilot.lua now has 'ft_disable' paramters, I think this problem can be avoided by adding 'dap-repl' to the parameters.
But I did not try it, because I have switched to compilot.vim

For the official github/copilot you do :
in a vimscript file (.vimrc for example)

let g:copilot_filetypes = {
      \ 'dap-repl': v:false,
      \ }

or in a .lua file

vim.api.nvim_set_var("copilot_filetypes", {
      ["dap-repl"] = false,
})