TerminalFi / LSP-copilot

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

How to stop the suggestion popup from appearing automatically? #72

Closed gilbert closed 1 year ago

gilbert commented 1 year ago

Inputting any character causes the copilot suggestion popup to appear. Aside from being annoying, I don't want to be sending network requests that often. I prefer to have it appear via a keyboard shortcut instead.

Is there a way to disable this?

TerminalFi commented 1 year ago

Right now we are mimicking VS Code. It seems there is two requests here

  1. Show suggestions on key binding usage
  2. Don't send suggestion requests to Copilot unless a key binding is used.

Is that correct?

gilbert commented 1 year ago

Only the second; the first is covered by adding this to sublime's keybindings json:

  {
    "keys": ["ctrl+super+c"],
    "command": "copilot_ask_completions",
    "context": [{ "key": "copilot.is_authorized" }],
  },
TerminalFi commented 1 year ago

That is correct, just making sure I understood you correct. As for the second, this could easily be added as well, however there would be a few side effects.

  1. UX would be slowed down, since now Copilot would be waiting for user to trigger the network request
  2. Suggestions may be less useful due to limiting its context.

Despite these, I can look into it

gilbert commented 1 year ago

Interesting, I'm curious about the second point. How would copilot's context be limited? Is it currently being constantly fed code as you type it, and it keeps that in record to make better suggestions? Meaning, limiting to a keystroke would only feed it part of the code somehow?

TerminalFi commented 1 year ago

Interesting, I'm curious about the second point. How would copilot's context be limited? Is it currently being constantly fed code as you type it, and it keeps that in record to make better suggestions? Meaning, limiting to a keystroke would only feed it part of the code somehow?

Yes exactly, it builds context as you work in your project. That's how it knows what to suggest. So the less network requests means less context. It learns off your code per session.

WillTaylor22 commented 1 year ago

I'd like to strongly request the "suggestions on key press only" option too.

I find it very distracting and interrupting to my train of thought to have suggestions pop up. Reading them only to usually dismiss them takes a second or two. This is especially a problem when coding when tired. Often I'm pausing just to remember the specific format for a command, but the pop-up will pop-up and break my train of thought.

Many thanks to the team at TerminalFi for everything they've done here.

jfcherng commented 1 year ago

I'd like to strongly request the "suggestions on key press only" option too.

Would the auto_ask_completions setting be for this already?

TerminalFi commented 1 year ago

Closing this as both of the requested features exist today.

Solves the keybinding https://github.com/TerminalFi/LSP-copilot/issues/72#issuecomment-1341862725 Solves the requests on ask only https://github.com/TerminalFi/LSP-copilot/issues/72#issuecomment-1381850644

nickturrietta commented 1 year ago

Only the second; the first is covered by adding this to sublime's keybindings json:

  {
    "keys": ["ctrl+super+c"],
    "command": "copilot_ask_completions",
    "context": [{ "key": "copilot.is_authorized" }],
  },

Hmm.. This solution isn't working for me. The suggestions popup whenever I stop typing. Have tried on two different Windows 10 computers. :/

TerminalFi commented 1 year ago

@nickturrietta what is your setting for auto_ask_completions

nickturrietta commented 1 year ago

screencap

I've tried different ”keys" variations but that didn't seem to help.

TerminalFi commented 1 year ago

screencap

I've tried different ”keys" variations but that didn't seem to help.

Yes that is fine. But you also have to change this setting auto_ask_completions in the LSP-Copilot: Settings

nickturrietta commented 1 year ago

Yes that is fine. But you also have to change this setting auto_ask_completions in the LSP-Copilot: Settings

Thanks @TerminalFi, that's it! I forgot that step. That setting didn't seem to work for me on my home PC a couple weeks ago, but it's working on my laptop today. Probably user error. Appreciate you!