Visual Studio 2022 introduced powerful AI-driven features like IntelliCode whole-line completions and GitHub Copilot integration. These tools display greyed-out "ghost text" inline suggestions right in your editor. However, many developers run into frustration when pressing Tab accepts an IntelliSense dropdown item instead of the greyed-out inline suggestion.

Understanding the Difference: IntelliSense vs. Inline Predictions

Before customizing shortcuts, it is helpful to understand why this behavior happens:

  • IntelliSense Pop-up Menu: The traditional dropdown list offering method, variable, and class completions.
  • Inline Predictions (IntelliCode / Copilot): The greyed-out ghost text that predicts whole lines or blocks of code ahead of your cursor.

When both are active, keypresses like Tab can sometimes conflict depending on which feature currently has focus.

How to Accept the Greyed-Out Inline Suggestion

By default, Visual Studio 2022 assigns the following controls to inline ghost text:

  • Accept entire suggestion: Press Tab (when the IntelliSense popup is closed or when inline prediction is focused).
  • Accept word-by-word: Press Ctrl + Right Arrow to insert the ghost text one word at a time.
  • Accept next character: Press Right Arrow.

If pressing Tab selects a item from the IntelliSense popup instead of inserting the greyed-out text, you can dismiss the pop-up menu first by hitting Esc, then press Tab to auto-fill the inline suggestion.

How to Customize the Keyboard Shortcut

If you want a dedicated key combination specifically to accept the greyed-out prediction regardless of IntelliSense context, you can remap the command in Visual Studio:

  1. Navigate to Tools > Options in the top menu bar.
  2. Expand Environment and select Keyboard.
  3. In the Show commands containing search box, type Edit.AcceptInlinePrediction.
  4. Select Edit.AcceptInlinePrediction from the list.
  5. Click in the Press shortcut keys box and input your preferred shortcut (e.g., Alt + Right Arrow or Tab).
  6. Click Assign, then press OK to save your changes.

Tweak IntelliCode Settings for Better Results

If inline predictions are not appearing reliably or are interfering with your typing flow, adjust your IntelliCode options:

  1. Go to Tools > Options > IntelliCode > General.
  2. Ensure Show completions for lines of code is checked.
  3. If you prefer inline completions over the standard popup, you can toggle Apply completions on Tab settings to fit your workflow.

By mastering these shortcuts and setting custom bindings for Edit.AcceptInlinePrediction, you can drastically speed up refactoring tasks and code editing in Visual Studio 2022.