TerminalFi / LSP-copilot

GitHub Copilot support for Sublime Text LSP plugin provided through Copilot.vim.
625 stars 25 forks source link

Split the display text into regions and display with multiple phantoms #53

Open timfjord opened 1 year ago

timfjord commented 1 year ago

Scenarios

  1. image

Expected regions: nt"

2.

image

Expected regions: nil values and do

TerminalFi commented 1 year ago

FYI, this wouldn't work if the completion is longer than lines in the view. So if the view is 3 lines long and the completion is 5 lines, it would need to be split into 3 regions.

Region 1: 1 Line Region 2: 1 Line Region 3: 3 Lines

jfcherng commented 1 year ago

I think he means inline completion gives a single phantom which contains text already in the view atm.

timfjord commented 1 year ago

Yeah, the idea of this issue is to parse the completion text before displaying the ghost text.
Currently, we show the entire string from the payload, but, when, for example, you are in the middle of the line and there is a trailing text, most of the time the ghost text is confusing

image

Like on the picture above, the ( symbol shouldn't be part of the completion

I will add more details to the issue later on.

Also, most likely this issue is valid only for single-line completion.

TerminalFi commented 1 year ago

I'll take a stab at this

timfjord commented 1 year ago

There is also an extreme case when you a completion should be split into multiple regions.
I will try to send a screenshot when I reproduce it

timfjord commented 1 year ago

@TheSecEng I've added some scenarios to the card description.