Skip to content

Invalid "end_col": out of range #52

Closed

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

Activity

  1. tris203 commented on Sep 2, 2025

    @tris203
    Collaborator

    I have seen this error before, but have really struggled with a consistent reproduction

    I have just been retrying now, and even forcing edits close to the end of a file, i cant reproduce this

    Image
  2. frankfriberg commented on Sep 10, 2025

    @frankfriberg
    Author

    Yeah, its hard to recreate. I sometimes get it alot but cant find a pattern...

  3. PMassicotte commented on Nov 6, 2025

    @PMassicotte

    Still having that popping all the time.

    Image
  4. tris203 commented on Nov 6, 2025

    @tris203
    Collaborator

    I think this should be fixed by #60
    It would be great if you could test

  5. PMassicotte commented on Nov 8, 2025

    @PMassicotte

    I am no longer receiving errors. Thank you for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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