LSP-copilot icon indicating copy to clipboard operation
LSP-copilot copied to clipboard

Complete word by word

Open TerminalFi opened this issue 2 years ago • 5 comments

Sometimes a completion is partially correct, the first x words or lines. It might be neat to add a complete word command that can be continuously pressed to incrementally complete the current suggestion

TerminalFi avatar Feb 16 '23 23:02 TerminalFi

I also noticed this, and this might be related to the latest announcements.

timfjord avatar Feb 17 '23 10:02 timfjord

I just tried to enable this using the same naming conventions as copilot.vim.

{
    "keys": ["alt+right"],
    "command": "copilot_accept_word",
    "context": [
      {
        "key": "setting.copilot.completion.is_visible"
      }
    ]
  },

I don't think LSP-copilot supports copilot_accept_word yet but it'd be nice if it did. I sometimes find the autocompletion is mostly right but I don't want to autocomplete for the whole thing.

creyes-pcty avatar Mar 04 '24 15:03 creyes-pcty

@jfcherng Does this seem feasible? From looking at the plugin code I think it is doable but I would need a bit more hand holding for a PR.

# chop this up word by word instead of the entire completion text
self.view.insert(edit, source_line_region.end(), completion["completionText"])

beautifulcoder avatar Mar 06 '24 21:03 beautifulcoder

@jfcherng Does this seem feasible? From looking at the plugin code I think it is doable but I would need a bit more hand holding for a PR.

# chop this up word by word instead of the entire completion text
self.view.insert(edit, source_line_region.end(), completion["completionText"])

I think you looked into a wrong place (panel completion). For normal autocompletion, it should be https://github.com/TerminalFi/LSP-copilot/blob/e6f295c8fff7f2c833f8e05f66f5ae0cde85a75e/plugin/commands.py#L184

It's probably a little confusing since it may be not obvious from the UI that what will happen after completing a word because there is no preview for the "word" only. And after completing a word, what should happen to the UI?

jfcherng avatar Mar 07 '24 02:03 jfcherng

I've thought about this, and it only really makes sense if Sublime had Ghost text support.

Come on HQ :(

Without it, I would expect the completion popup to reappears with the completion text minus the accepted word.

TerminalFi avatar Mar 07 '24 02:03 TerminalFi