Skip to content

Invalid "end_col": out of range #52

@frankfriberg

Description

@frankfriberg

Hi
I get this error multiple times a day.

Error executing vim.schedule lua callback: ...l/share/nvim/lazy/copilot-lsp/lua/copilot-lsp/nes/ui.lua:136: Invalid 'end_col': out of range
stack traceback:
        [C]: in function 'nvim_buf_set_extmark'
        ...l/share/nvim/lazy/copilot-lsp/lua/copilot-lsp/nes/ui.lua:136: in function '_display_preview'
        ...l/share/nvim/lazy/copilot-lsp/lua/copilot-lsp/nes/ui.lua:176: in function '_display_next_suggestion'
        ...share/nvim/lazy/copilot-lsp/lua/copilot-lsp/nes/init.lua:25: in function 'handler'
        .../neovim/0.11.3/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Heres my config for copilot_lsp:

return {
  "copilotlsp-nvim/copilot-lsp",
  init = function()
    vim.g.copilot_nes_debounce = 500
    vim.lsp.enable("copilot_ls")

    vim.keymap.set("n", "<tab>", function()
      local bufnr = vim.api.nvim_get_current_buf()
      local state = vim.b[bufnr].nes_state
      if state then
        local _ = require("copilot-lsp.nes").apply_pending_nes() and require("copilot-lsp.nes").walk_cursor_end_edit()
        return nil
      else
        -- Resolving the terminal's inability to distinguish between `TAB` and `<C-i>` in normal mode
        return "<C-i>"
      end
    end, { desc = "Accept Copilot NES suggestion", expr = true })
  end,
  opts = {
    nes = {
      move_count_threshold = 3,
    },
  },
}

It happens when the cursor is close to end of buffer. I don't have space underneath the buffer, it just ends
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions