When the accept function is mapped to the <Tab> keymap, tabulation is not inserted when there is no suggestion available.
Unlike github/copilot.vim, copilot.nvim effectively inserts a tab even when there is no suggestion available.
The cause of this problem lies in the early void return statement found in all accept functions:
A potential solution to this issue, although it requires further testing to ensure there are no unintended side effects, could involve making the following code modification:
if not suggestion or vim.fn.empty(suggestion.text) == 1 then
local key = config.get("suggestion").keymap.accept
key = vim.api.nvim_replace_termcodes(key, true, false, true)
vim.fn.feedkeys(key, "n")
return
end
When the accept function is mapped to the
<Tab>
keymap, tabulation is not inserted when there is no suggestion available. Unlike github/copilot.vim, copilot.nvim effectively inserts a tab even when there is no suggestion available.The cause of this problem lies in the early void return statement found in all accept functions:
https://github.com/zbirenbaum/copilot.lua/blob/1a8032ae496916ccc7a7a52ee79194fbef29f462/lua/copilot/suggestion.lua#L444-L447
A potential solution to this issue, although it requires further testing to ensure there are no unintended side effects, could involve making the following code modification: