Setting Up GitHub Copilot in Visual Studio Code. If you are using GitHub Codespaces, all required extensions and packages should be installed already
-
Install Visual Studio Code:
- If you haven't already, download and install Visual Studio Code from here.
-
Install GitHub Copilot:
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing
Cmd+Shift+X. - Search for "GitHub Copilot" and click the "Install" button.
-
Sign In to GitHub Copilot:
- After installation, you will be prompted to sign in to GitHub Copilot.
- Follow the on-screen instructions to authenticate with your GitHub account.
-
Verify Installation:
- Open a new file in Visual Studio Code.
- Start typing a comment or a piece of code, and you should see suggestions from GitHub Copilot.
- If you see suggestions, GitHub Copilot is successfully installed and ready to use.
-
Basic Usage:
- Create a new JavaScript file (
example.js). - Start typing a function definition, e.g.
function add(a, b) {. - Observe how GitHub Copilot suggests the implementation of the function.
- Accept the suggestion by pressing
Tab.
- Create a new JavaScript file (
-
Exploring Different Features:
- Code Completions:
- Start typing a comment or code, and GitHub Copilot will provide inline suggestions.
- Accept suggestions by pressing
Tab.
- Chat:
- Open the Command Palette (
Cmd+Shift+P). - Type "GitHub Copilot: Chat" and select it.
- Use the chat interface to ask questions or request code snippets.
- Open the Command Palette (
- Inline Chat:
- Highlight a piece of code.
- Right-click and select "Ask GitHub Copilot".
- Use the inline chat to get explanations or improvements for the selected code.
- Code Completions:
By the end of this step, you should have GitHub Copilot ready and be familiar with its basic functionality, including code completions, chat, and inline chat in Visual Studio Code.