zbirenbaum / copilot-cmp

Lua plugin to turn github copilot into a cmp source
MIT License
1.08k stars 39 forks source link

multiple virtual lines (ghost_text) possible? #21

Closed benwoodward closed 10 months ago

benwoodward commented 1 year ago

I'm so impressed with copilot and this plugin has made it super easy to get it working nicely with neovim.

The only issue I have is that Copilot likes to suggest multiple lines, and sometimes quite a lot of them.

In VS Code, if there are multiple lines they are printed as virtual lines (and the rest of the lines are moved down). With copilot-cmp I'm not seeing any indication that Copilot is suggesting more than one line, and I can't see any indication that the suggestion is a multi-line suggestion, and if I undo the suggestion after it has been inserted into the buffer, it actually undoes the last 2 completions, rather than just one.

EDIT: Actually, I can see the whole suggestion in the menu, I think enabling view.entries fixed this(?):

image

However, ideal solution would be multi-line ghost text.

zbirenbaum commented 1 year ago

Multi line ghost text as it's own thing (copilot.vim style, no cmp involved) has been on the todo list for a while, and at one point I half completed it, but I wasn't sure how many people used it so it hasn't been a priority. If you think it would be useful, I'll see about finishing implementing it sooner rather than later. I wrote copilot cmp partially because I found that big block of ghost text moving stuff around jarring and distracting, and liked having it in a cmp view, but I would like to support it for anyone who likes it.

Currently, ghost text is supplied via cmp (if you have it set up in your cmp config) and I would have to probably upstream some stuff to have a multi line on hover. I've upstreamed some patches to cmp before to support things here, but it does usually take a month or two to complete the process since both hrsh7th and myself are fairly busy people right now it seems.

Also, could you elaborate on the undo issue? I'm not sure what you mean by undoing the last two completions.

benwoodward commented 1 year ago

Also, could you elaborate on the undo issue? I'm not sure what you mean by undoing the last two completions.

I’ll try to capture it with a screen recording. Hard to explain.

I’ll try to capture it with a screen recording. Hard to explain.

Glad to hear that multi-line ghost text is on the roadmap! Do you take donations?

MunifTanjim commented 1 year ago

@benwoodward you can now just use https://github.com/zbirenbaum/copilot.lua for multiline ghost text for suggestions and also cycle between multiple suggestions.

YodaEmbedding commented 1 year ago

Related feature request:

Ghost text with inline virtual text displacement. e.g.,

def add():
        ^---cursor_here

def add( self, x: int, y: int ):
         ^--- ghost text ---^
              suggestion

Now, press the keybinding for lua cmp.mapping.confirm() to accept it.

zbirenbaum commented 10 months ago

This issue is stale and would need to be upstreamed so I'm going to close it for now. If anyone wants to PR it to nvim-cmp please let me know and I'll do whatever is necessary on copilot-cmp's end to support it.