How to Use GitHub Copilot Inline Suggestions in VS Code

Use GitHub Copilot inline suggestions in VS Code to get ghost text completions and next edit suggestions as you type. Learn to accept, reject, and control suggestions.

6 min read

Copilot inline suggestions appear as dimmed ghost text in your editor as you type. There are two kinds: ghost text suggestions that complete the current line, and next edit suggestions that predict what you will change next and where.

Before starting, make sure Copilot is active. If the Copilot icon in the Status Bar shows as inactive, follow the /vscode/how-to-set-up-github-copilot-free-in-vs-code guide first.

Ghost text suggestions

As you type in any code file, Copilot shows dimmed text completing the current line, the next few lines, or an entire block of code. This is a ghost text suggestion.

Accept or reject a suggestion

ActionWindows/LinuxmacOS
Accept full suggestionTabTab
Accept the next word or lineCtrl+Right ArrowCmd+Right Arrow
Reject suggestionEscapeEscape

To partially accept a suggestion, press Ctrl+Right Arrow (or Cmd+Right Arrow on macOS). Copilot accepts the next word and the suggestion adjusts. Press it again to accept the next word. Press Escape to dismiss the remaining ghost text.

See alternative suggestions

Hover over a ghost text suggestion. If Copilot generated multiple alternatives, a hover menu appears showing the options. Select a different suggestion to replace the current one.

Not every suggestion has alternatives. Copilot shows alternatives when it is less certain about the best completion.

Generate suggestions from comments

Write a comment describing what you want, then press Enter. Copilot reads the comment and generates code that matches your description.

For example, in a JavaScript file, type:

index.jsindex.js
// create a Student class with name, email, and GPA properties, plus a method that returns honor roll status

Press Enter, and Copilot can suggest an implementation on the next line. Review the generated code for correctness, security, and edge cases before accepting it.

Be specific in your comments. "Sort the array using quicksort" produces better suggestions than "sort the array."

Next edit suggestions (NES)

Next edit suggestions predict not just what code to write, but where your next edit should be and what it should be. Based on the edit you just made, Copilot looks ahead and suggests related changes in other parts of the file.

Enable next edit suggestions

NES requires the github.copilot.nextEditSuggestions.enabled setting. Open the Settings editor (Ctrl+, or Cmd+,), search for "next edit suggestions," and check the box. If the setting is grayed out, your organization may manage it.

How NES appears

VS Code marks a next edit suggestion in the editor and can show a gutter arrow toward a suggestion outside the current view. Hover over the indicator to preview the change and see the available actions.

Press Tab to navigate to and accept the suggested edit. Copilot can then offer another related edit, which you can review before pressing Tab again.

What NES catches

  • Typo fixes: typing conts suggests changing to const.
  • Logic errors: an inverted ternary or the wrong logical operator.
  • Cascading renames: rename a variable once, and NES suggests updating it everywhere else in the file.
  • Intent changes: add a z property to a class, and NES suggests updating related calculations to use z.
  • Style matching: after pasting code, NES suggests adjusting it to match the surrounding code style.

Reduce distractions from NES

By default, NES shows the full code change in the editor when you Tab to it. Enable the editor.inlineSuggest.edits.showCollapsed setting to show changes only when you Tab to the suggestion or hover over the gutter arrow. This keeps the editor cleaner when you do not want to see pending edits.

Enable or disable suggestions

Globally or per language

Select the Copilot icon in the Status Bar. The menu shows checkboxes to enable or disable inline suggestions. It also shows an option to disable suggestions for the specific language of the active editor.

For fine-grained control, use the github.copilot.enable setting. Add this complete object to settings.json to disable suggestions for Markdown and plain text:

jsonjson
{
  "github.copilot.enable": {
    "markdown": false,
    "plaintext": false
  }
}

Set "*": false to disable suggestions for all languages, then enable only the languages you want.

Snooze temporarily

When you want to focus without suggestions for a few minutes, select the Copilot icon in the Status Bar and choose Snooze. This pauses all inline suggestions for 5 minutes.

Each selection of Snooze adds another 5 minutes. Select Cancel Snooze to resume.

Snoozing does not affect Copilot Chat or agents. Only inline suggestions are paused.

Settings reference

SettingWhat it controls
github.copilot.enableEnable or disable inline suggestions per language
github.copilot.nextEditSuggestions.enabledEnable next edit suggestions
editor.inlineSuggest.showToolbarShow or hide the hover toolbar on suggestions
editor.inlineSuggest.syntaxHighlightingEnabledEnable syntax highlighting in ghost text
editor.inlineSuggest.edits.showCollapsedCollapse NES changes until you Tab to them
editor.inlineSuggest.edits.renderSideBySideShow large NES edits side by side or below

Tips for better suggestions

Keep related files open in your editor. Copilot looks at open tabs to understand context. The more relevant context Copilot has, the better the suggestions.

Name your functions and variables descriptively. calculateMonthlyRevenue gives Copilot more to work with than calc. Write short, descriptive comments above functions even when not using comment-driven generation.

If suggestions feel unrelated to your code, open the files that define the functions or types you are using. Copilot reads across open tabs but does not automatically load your entire project. For chat-based assistance, learn how to /vscode/how-to-use-copilot-chat-with-files-folders-symbols-and-terminal-context.

Rune AI

Rune AI

Key Insights

  • Ghost text suggestions appear as dimmed text as you type. Press Tab to accept a full suggestion or Cmd/Ctrl+Right Arrow to accept part of it.
  • Next edit suggestions predict both the location and content of a likely next edit.
  • Hover over ghost text to see its controls and any available alternatives.
  • Descriptive comments can guide the next suggestion, but generated code still needs review.
  • Snooze from the Copilot Status Bar menu to pause inline suggestions temporarily.
  • Enable NES with the github.copilot.nextEditSuggestions.enabled setting.
RunePowered by Rune AI

Frequently Asked Questions

How do I temporarily stop Copilot from suggesting code?

Select the Copilot icon in the Status Bar and choose Snooze. Each selection adds five minutes. Select Cancel Snooze from the same menu to resume. Snoozing affects inline suggestions, not chat.

What should I check if Tab does not accept a suggestion?

Open Keyboard Shortcuts and check whether an extension or custom keybinding overrides Tab. You can also hover over the suggestion to see the currently assigned actions.

How do I change the model used for inline suggestions?

Select Configure Inline Suggestions from the Chat menu, then select Change Completions Model. The option appears only when alternative completion models are available for your account and organization policies.

Conclusion

Ghost text suggestions complete the line you are typing. Next edit suggestions predict what you will change next. Use Tab to accept, Escape to reject, and hover for alternatives. When suggestions get distracting, press Escape or enable collapsed mode for next edit suggestions.