TerminalFi / LSP-copilot

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

Complete word by word #86

Open TerminalFi opened 1 year ago

TerminalFi commented 1 year ago

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

timfjord commented 1 year ago

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

creyes-pcty commented 4 months ago

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.

beautifulcoder commented 4 months ago

@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"])
jfcherng commented 4 months ago

@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?

TerminalFi commented 4 months ago

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.