zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.43k stars 64 forks source link

suggestion.lua executes an assignment *only* with 0.10.x but not 0.11.0+ ? #295

Open proofer opened 3 weeks ago

proofer commented 3 weeks ago

I was reading the title module in order to understand what the config's suggestion.enabled actually controls, and I encountered near the top:

 local _, has_nvim_0_10_x = pcall(function()
   return vim.version().minor == 10
 end)

then down below the sole reference to has_nvim_0_10_x:

  local cursor_keys = "<End>"
  if has_nvim_0_10_x then
    cursor_keys = string.rep("<Down>", #vim.split(newText, "\n", { plain = true }) - 1) .. cursor_keys
  end

Now, I am pretty ignorant, so I have to allow for the possibility that the call to string.rep should be made only with 0.10.0. But I worry.