Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompleting suggestion broken after latest Neovim update #273

Closed
danielpost opened this issue Feb 25, 2024 · 3 comments · Fixed by #274
Closed

Autocompleting suggestion broken after latest Neovim update #273

danielpost opened this issue Feb 25, 2024 · 3 comments · Fixed by #274

Comments

@danielpost
Copy link

After updating Neovim, I'm getting the following error when trying to autocomplete:

E5108: Error executing lua: ...vim/HEAD-0fcbda5/share/nvim/runtime/lua/vim/lsp/util.lua:423: Explicit buffer number is required
stack traceback:
	[C]: in function 'assert'
	...vim/HEAD-0fcbda5/share/nvim/runtime/lua/vim/lsp/util.lua:423: in function 'apply_text_edits'
	...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:487: in function <...l/share/nvim/lazy/copilot.lua/lua/copilot/suggestion.lua:445>

It is almost definitely related to this change: neovim/neovim#27614, and I think the fix would be to pass the current buffer here, but I don't know enough about Lua to be 100% sure.

@siblanco
Copy link

siblanco commented Feb 25, 2024

hi, you are right, for a quickfix, do this

  vim.lsp.util.apply_text_edits({ { range = range, newText = newText } }, vim.api.nvim_get_current_buf(), "utf-16")

@GitMurf
Copy link

GitMurf commented Feb 26, 2024

I am getting the same problem on Windows 11 fyi. And I can confirm the fix provided by @siblanco works so thank you both!

@fgheng
Copy link

fgheng commented Feb 28, 2024

I am getting the same problem on Windows 11 fyi. And I can confirm the fix provided by @siblanco works so thank you both!

hello, where add this, I add it to lazy config:

config = function()
  vim.lsp.util.apply_text_edits({ { range = range, newText = newText } }, vim.api.nvim_get_current_buf(), "utf-16")
end

where can I take the params range and newText

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants