zbirenbaum / copilot.lua

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

Suggestion is not completely shown when it takes up more than the end of the line #161

Closed carmilso closed 1 year ago

carmilso commented 1 year ago

I'm facing an issue that I am sure is simple to fix, but I have spent some time trying it and I can't figure it out.

The problem comes when the suggestion is longer than what is left to reach the end of the line, as you can see in the following picture:

copilot-1

However, If I do accept the suggestion, this is what it should have appeared in the previous picture:

copilot-2

So as you can see, the suggestion isn't complete when it first appears, at least until I accept it. Any ideas?

MunifTanjim commented 1 year ago

Copilot is suggesting one long line without any line breaks. And Neovim's virtual text doesn't wrap, so the virtual text showing the copilot suggestion is going beyond the screen.

carmilso commented 1 year ago

I see... Thanks for the answer. So do you think there may be some workaround to show the entire suggestion?

MunifTanjim commented 1 year ago

Unless Neovim supports it, nope. Also, I'm not sure if it's worth it. You can do one of the following:

carmilso commented 1 year ago

Okay, thanks. It's a bit annoying because in Vim you can see the full suggestion but I will accept it and then edit manually

MunifTanjim commented 1 year ago

Yeah, looks like vim's virtual text supports wrapping.

You can create a feature request for Neovim: https://github.com/neovim/neovim/issues

carmilso commented 1 year ago

Yeah, looks like vim's virtual text supports wrapping.

You can create a feature request for Neovim: https://github.com/neovim/neovim/issues

I will. Thanks for the suggestion!

carmilso commented 1 year ago

@MunifTanjim wouldn't it be possible to use a keymap to move the Copilot's suggestion to a popup (like cmp) so it is fully shown?

MunifTanjim commented 1 year ago

Yep, that would be possible to implement.