p:: AI f:: GitHub CLI

Getting code suggestions in your IDE with GitHub Copilot

Key CombinationAction
TabAccept the suggestion
Option (⌥) or Alt + ]See next suggestion
Option (⌥) or Alt + [See previous suggestion
Ctrl + EnterShow multiple suggestions in a new tab
Command + Accept Next Word

Asking GitHub Copilot questions in your IDE

Key CombinationAction
Control + Command + iOpen the chat view
Command + iStart an inline chat
Shift + Command + iQuick chat dropdown
  • Smart actions: To submit prompts via the context menu, right click in your editor, select Copilot in the menu that appears, then select one of the actions. Smart actions can also be accessed via the sparkle icon that sometimes appears when you select a line of code.

Chat participants

  • AI-powered chat conversations with GitHub Copilot

  • @workspace has context about the code in your workspace and can help you navigate it, finding relevant files or classes.

  • @vscode knows about commands and features in the VS Code editor itself, and can help you use them.

  • @terminal has context about the integrated terminal shell and its contents.

  • @github has knowledge about your GitHub repositories, issues, pull requests, and topics, and can also perform web searches using the Bing API.

Extensions can also contribute chat participants to provide specialized help for their domain. You can install these extensions from GitHub Marketplace and from Visual Studio Code Marketplace.

Slash commands

CommandDescription
/explainExplain the selected code
/fixPropose a fix for problems in the selected code
/testsGenerate unit tests for the selected code
/newScaffold code for a new workspace or new file
/clearStart a new chat

Chat context

  • AI-powered chat conversations with GitHub Copilot

  • #codebase: the contents of the current workspace. It includes information about the files and folders in your workspace, as well as any settings or configurations specific to that workspace.

  • #file: Include a specific file as context in the chat.

  • #selection: the visible source code in the active editor.

  • #terminalLastCommand: the active terminal’s last run command.

  • #terminalSelection: the active terminal’s selection.

  • #editor: the code in the active editor. The editor content is implicitly included in the Chat view context.

  • #vscodeAPI: use VS Code API references to answer questions about VS Code extension development.

Prompt Engineering for GitHub Copilot