skip to content

How do you accept, partially accept, cycle or dismiss GitHub Copilot ghost text in VS Code?

level: juniorimportance: must knowfreq 22%

answer

  1. one key takes it all
  2. a word at a time
  3. Command or Control plus right arrow
  4. Alt or Option with brackets
  5. Ctrl+Enter opens a whole tab

basics

~20 s

Tab accepts the whole ghost-text suggestion and Esc dismisses it; Accept Next Word (Command+Right on macOS, Control+Right on Windows and Linux) takes one word, and Alt+] or Alt+[ (Option on macOS) cycles through alternative suggestions.

solid answer

~40 s

In VS Code, `Tab` accepts the whole dimmed suggestion (`editor.action.inlineSuggest.commit`) and `Esc` dismisses it. To take only part of it, **Accept Next Word** is `Command+→` on macOS and `Control+→` on Windows and Linux, or the **Accept Word** button in the control that appears when you hover the suggestion; accepting the next line is a separate command, `editor.action.inlineSuggest.acceptNextLine`, which GitHub's docs tell you to bind yourself. Copilot may hold several alternatives for the same position: hover to get forward and back arrows, or press `Alt+]` / `Alt+[` (`Option` on macOS). `Ctrl+Enter` opens a separate tab with multiple additional suggestions, and `Alt+\` (`Option+\`) triggers a suggestion by hand. Every key can be rebound in the Keyboard Shortcuts editor by searching the command name.

go deeper

for a junior

Recall the four moves cold: Tab accepts, Esc dismisses, Command or Control plus Right takes a word, Alt or Option plus a bracket cycles alternatives.

for a middle

Explain partial acceptance by word and by line, the hover control and the Ctrl+Enter suggestions tab, and that each key maps to a named command you can rebind.

for a senior

Show the habit that keeps generated code honest: accept in small pieces, cycle alternatives instead of editing a bad block, and rebind keys that collide with your team's editor setup.

for a principal

Treat these keys as onboarding material: a team that knows partial accept and alternatives takes less unread code into the file than one that only knows Tab.

## What ghost text is GitHub Copilot in VS Code shows **ghost text**: a dimmed suggestion drawn at the cursor as you type. Sometimes it is the end of the current line, sometimes a whole block such as a function body. You can also steer it with a natural-language comment ("write a function to find all images without alternate text") and Copilot suggests code under it. Nothing is inserted until you accept it, and the keys you use decide **how much** of it lands in the file. ## The default keys GitHub's keyboard-shortcut reference for Copilot in VS Code lists the defaults and the command behind each one: | Action | macOS | Windows / Linux | Command | |---|---|---|---| | Accept the whole suggestion | `Tab` | `Tab` | `editor.action.inlineSuggest.commit` | | Dismiss it | `Esc` | `Esc` | `editor.action.inlineSuggest.hide` | | Next alternative | `Option+]` | `Alt+]` | `editor.action.inlineSuggest.showNext` | | Previous alternative | `Option+[` | `Alt+[` | `editor.action.inlineSuggest.showPrevious` | | Trigger a suggestion | `Option+\` | `Alt+\` | `editor.action.inlineSuggest.trigger` | | More suggestions in a separate pane | `Ctrl+Return` | `Ctrl+Enter` | `github.copilot.generate` | | Toggle Copilot on or off | no default | no default | `github.copilot.toggleCopilot` | **Enter does not accept ghost text**; `Tab` does. ## Partial acceptance A long suggestion is often right for its first few tokens and wrong after that. Instead of accepting and then deleting, take only what you trust: - **Accept Next Word** — `Command+→` on macOS, `Control+→` on Windows and Linux (command `editor.action.inlineSuggest.acceptNextWord`). Press it repeatedly to walk through the suggestion a word at a time; the rest stays as ghost text. - **Accept Word** in the hover control does the same with the mouse. - **Accept the next line** is its own command, `editor.action.inlineSuggest.acceptNextLine`. GitHub's how-to says that to use it you set a custom keyboard shortcut for that command. ## Alternatives and the suggestions tab For a given position Copilot may have more than one suggestion. There are three ways to see them: 1. **Hover** the ghost text. A small control appears with forward and back arrows; click them to cycle, then press `Tab` to take the one showing. 2. Press **`Alt+]` / `Alt+[`** (`Option` on macOS) to move to the next or previous alternative without the mouse. 3. Press **`Ctrl+Enter`** to open a **new tab** listing multiple additional options. Each has an **Accept suggestion NUMBER** link under it; closing the tab rejects them all. The hover control is governed by `editor.inlineSuggest.showToolbar`, whose default is `"onHover"`. ## Triggering by hand and rebinding Ghost text normally appears on its own as you type. When it does not — for example because VS Code treats your connection as metered and stops starting automatic requests — `Alt+\` (`Option+\` on macOS), the **Trigger Inline Suggestion** command, asks for one explicitly. Any of these keys can collide with an existing habit — `Command+→` and `Control+→` are familiar cursor-movement keys. Open the **Keyboard Shortcuts** editor, search for the command name from the table, and rebind it. Because the commands are VS Code's `editor.action.inlineSuggest.*` family, a rebinding changes the key, not the behaviour. ## Steering a suggestion with a comment Ghost text does not have to wait for you to start typing code. Write a comment that describes what you want — a type of algorithm ("use recursion"), a pattern ("use a singleton pattern"), or the methods and properties a class should have — and Copilot suggests the code beneath it. The same keys apply: `Tab` takes the whole body, Accept Next Word walks into it, and `Alt+]` shows another take on the same comment. ## Settings that change how ghost text looks These VS Code settings change presentation, not the keys: | Setting | Default | What it does | |---|---|---| | `editor.inlineSuggest.showToolbar` | `"onHover"` | When the toolbar with the arrows and Accept Word appears | | `editor.inlineSuggest.syntaxHighlightingEnabled` | `true` | Syntax colouring inside the ghost text | | `editor.inlineSuggest.fontFamily` | `"default"` | Font used for the ghost text | | `editor.inlineSuggest.minShowDelay` | `0` | Milliseconds to wait before showing a suggestion | ## Common mistakes - Treating ghost text like an autocomplete list and pressing **Enter** to accept it. - Accepting a whole multi-line block with `Tab` and then deleting most of it, instead of taking it word by word. - Retyping a line because "Copilot only had one idea", when `Alt+]` or `Ctrl+Enter` would have shown others. - Assuming the next-line partial accept has a default key like Accept Next Word does; GitHub's docs say to bind it.

  • Accept Next Word on Control+Right clashes with your word-jump habit. How do you change it without losing the feature?
    Open the Keyboard Shortcuts editor, search for `editor.action.inlineSuggest.acceptNextWord`, and assign a different key. The command and its behaviour are unchanged; only the binding moves. GitHub's docs recommend searching by command name in that editor for every Copilot inline-suggestion shortcut.
  • What does Ctrl+Enter give you that Alt+] does not?
    `Alt+]` cycles the alternatives one at a time in place. `Ctrl+Enter` (`github.copilot.generate`) opens a separate tab that lists multiple additional suggestions together, each with an **Accept suggestion NUMBER** link; closing that tab rejects them all. It suits comparing several bodies side by side.
  • How do you take only the first line of a five-line Copilot suggestion?
    Use the next-line partial accept, the command `editor.action.inlineSuggest.acceptNextLine`. GitHub's how-to says you set a custom keyboard shortcut for it; once bound, each press accepts one more line and leaves the rest as ghost text. Pressing Accept Next Word repeatedly also works, a word at a time.

  • Pressing Enter accepts a Copilot ghost-text suggestion, like an autocomplete list.
  • You can only take a Copilot suggestion whole or not at all.
  • Copilot offers exactly one suggestion per position, so a bad one must be retyped.
  • Tab accepts only the current line of a multi-line Copilot suggestion.
  • Copilot's inline-suggestion keys are fixed and cannot be rebound in VS Code.