Beginner
How to accept or reject code suggestions on GitHub Copilot
Quick Answer
GitHub Copilot provides inline code suggestions that you can accept with Tab, reject with Esc, or cycle through alternatives with Alt+] and Alt+[. You can also accept suggestions partially using Ctrl+→ to accept word by word.
Prerequisites
- GitHub Copilot extension installed in your IDE
- Active GitHub Copilot subscription
- Copilot enabled in your editor settings
- Basic familiarity with your code editor
1
Trigger Copilot suggestions
Start typing code in your editor or add a comment describing what you want to accomplish. GitHub Copilot will automatically display suggestions in gray text after the cursor. The suggestions appear inline as you type, typically after a brief pause.
Tip
Copilot works best with descriptive comments and clear context from surrounding code.
2
Accept the entire suggestion
When you see a suggestion you want to use, press the Tab key to accept the entire suggestion. The gray text will become regular code and be inserted into your file. You can also click the Accept button if it appears in the suggestion popup.
3
Accept partial suggestions
To accept only part of a suggestion, use Ctrl+→ (or Cmd+→ on Mac) to accept the suggestion word by word. This allows you to take only the parts you need while rejecting the rest. Press Ctrl+Alt+→ to accept the next line only.
Tip
Partial acceptance is useful when Copilot suggests more code than you need.
4
Reject suggestions
Press the Esc key to dismiss the current suggestion without accepting it. You can also simply continue typing to override the suggestion. The gray suggestion text will disappear and won't be inserted into your code.
Tip
Continuing to type naturally replaces suggestions, so you don't always need to explicitly reject them.
5
Browse alternative suggestions
Use Alt+] to see the next alternative suggestion or Alt+[ to see the previous one. You can cycle through multiple suggestions before deciding which one to accept. The number of available alternatives is usually shown in the suggestion popup.
Tip
Copilot often provides 2-10 alternative suggestions, so explore your options before accepting.
6
Use the Copilot suggestions panel
Open the suggestions panel by pressing Ctrl+Enter (or using the command palette and searching for GitHub Copilot: Show suggestions). This displays all available suggestions in a separate panel where you can preview and select from multiple options at once.
Tip
The panel view is helpful when you want to compare several suggestions side by side.
7
Configure suggestion behavior
Access Copilot settings through your editor's settings menu or command palette. You can adjust suggestion delay, auto-trigger behavior, and suggestion display preferences. Look for GitHub Copilot in your editor's extension settings.
Tip
Adjust the suggestion delay if you find suggestions appearing too quickly or slowly while typing.
Troubleshooting
Suggestions not appearing
Check that Copilot is enabled in your editor status bar and verify your subscription is active. Try refreshing the editor or restarting the Copilot extension through the command palette.
Tab key not accepting suggestions
Ensure no other extensions are overriding the Tab key behavior. Check your editor's keybinding settings and look for conflicts with the
editor.action.inlineSuggest.commit command.Poor quality suggestions
Provide more context by adding descriptive comments or ensuring your file has proper imports and type definitions. Copilot works better with clear context about what you're trying to accomplish.
Suggestions appearing too frequently
Adjust the suggestion trigger settings in Copilot preferences. You can increase the delay or disable automatic triggering and use Alt+\ to manually trigger suggestions when needed.
Ready to get started with GitHub Copilot?
Put this tutorial into practice. Visit GitHub Copilot and follow the steps above.
Visit GitHub Copilot →