0% found this document useful (0 votes)
44 views15 pages

01-GitHub Copilot in VS Code

GitHub Copilot is an AI-powered coding assistant integrated into Visual Studio Code, providing code suggestions, bug fixes, and project scaffolding. Users can start for free with a Copilot Free plan and utilize features like Inline Chat, Copilot Edits, and keyboard shortcuts for enhanced productivity. The tool supports various coding tasks, including refactoring, generating tests, and creating documentation tailored to the user's codebase.

Uploaded by

nicobar14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views15 pages

01-GitHub Copilot in VS Code

GitHub Copilot is an AI-powered coding assistant integrated into Visual Studio Code, providing code suggestions, bug fixes, and project scaffolding. Users can start for free with a Copilot Free plan and utilize features like Inline Chat, Copilot Edits, and keyboard shortcuts for enhanced productivity. The tool supports various coding tasks, including refactoring, generating tests, and creating documentation tailored to the user's codebase.

Uploaded by

nicobar14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

GitHub Copilot in VS Code https://code.visualstudio.

com/docs/copilot/overview

🚀 Get GitHub Copilot Free (vscode://github.copilot-chat?referrer=vscode-updatebanner) in VS


Code!
×

TOPICS Overview

IN THIS ARTICLE Getting started

(https://vscode.dev/github/microsoft/vscode-docs/blob/main/docs/copilot/overview.md)

GitHub Copilot in VS Code


GitHub Copilot (https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) is your AI pair
programmer tool in Visual Studio Code. Get code suggestions as you type or use Inline Chat in the editor
to write code faster. Add new functionality or resolve bugs across your project with Copilot Edits, or use
natural language in chat to explore your codebase.

Tip
If you don't yet have a Copilot subscription, you can use Copilot for free by signing up for the Copilot
Free plan (https://github.com/github-copilot/signup) and get a monthly limit of completions and chat
interactions.

GitHub Copilot can provide assistance in a variety of scenarios.

! Get code suggestions as you type

" Make large changes across multiple files

# Ask questions about your code

$ Refactor and improve your code

% Fix code issues and debugging

1 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

& Scaffold a new project or files

' Configure and generate tests

( Generate code documentation

) Improve your productivity in VS Code

Getting started

1 Select Use AI Features with Copilot for Free... from the Copilot menu in the VS Code title bar

2 Sign in with your GitHub account to use Copilot

Tip
You can get started for free with the Copilot Free plan (https://github.com/github-copilot/
signup) if you don't yet have a Copilot subscription. Follow the steps in the setup guide (/docs/
copilot/setup) to set up a Copilot subscription.

3 Discover the key features of Copilot in VS Code with our Copilot Quickstart (/docs/copilot/getting-
started).

Keyboard shortcuts

Use the following keyboard shortcuts to start a chat conversation with Copilot:

Shortcut Description

⌃⌘I Open the Chat view and start a chat conversation with Copilot by using natural language.

⇧⌘I Open the Copilot Edits view and start a code editing session across multiple files.

⇧⌥⌘L Open Quick Chat and ask a quick question to Copilot.

⌘I Start Inline Chat to send a chat request to Copilot directly from the editor. Use natural
language or use / commands to give instructions to Copilot.

2 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

Check our Copilot cheat sheet (/docs/copilot/copilot-vscode-features) for an overview of the key Copilot
commands and shortcuts.

Use cases for GitHub Copilot in VS Code

Code completions in the editor


• Copilot suggests code as you type. Copilot analyzes the context in the file you're editing and
related files, and offers suggestions from within the editor. For example, begin typing the name of a
method and Copilot suggests the implementation, following your coding style.

• Predict your next code edit with Copilot Next Edit Suggestions (Copilot NES) (preview). Based on
the edits you're making, Copilot NES both predicts the location of the next edit you'll want to make
and what that edit should be. Use the Tab key to quickly navigate and accept suggestions. Learn
how to get started with Copilot NES (/docs/copilot/ai-powered-suggestions#_next-edit-
suggestions-preview).

Iterate on large changes across multiple files


• Start a AI-powered code editing session. Copilot Edits (/docs/copilot/copilot-edits) brings the
conversational flow of Copilot Chat and fast feedback from Inline Chat together in one experience.

3 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

Have an ongoing, multi-turn chat conversation on the side, while benefiting of inline code
suggestions.

Answer coding questions


• Provide guidance and support for common coding tasks and challenges. Ask Copilot about
syntax or general programming concepts without requiring to navigate documentation or search
online forums. Copilot gives responses in natural language format or in code snippet format. For
example, you can ask questions such as "what is recursion?" or "how to create a singleton in Java?".

4 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Improve code understanding by explaining selected code. Copilot generates natural language
descriptions of the code's functionality and purpose. This can be useful if you want to understand
the code's behavior or for non-technical stakeholders who need to understand how the code works.

• Provide guidance that is specific to your codebase. Copilot has the context of your workspace and
can give step-by-step guidance and code samples that are tailored to your project. For example,
"how to add a contacts page?" or "how do I read customer data from the database?".

5 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

Code refactoring and improvements


• Provide suggestions for implementing code refactorings. Copilot suggests refactorings using the
context of your codebase. For example, ask Copilot to refactor a function to not use recursion, or to
suggest an algorithm that can improve performance.

6 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Suggest potential improvements to selected code, such as improved handling of errors and edge
cases, or changes to the logical flow to make the code more readable.

Fix issues
• Propose a fix for bugs in your code with the /fix command by suggesting code snippets and
solutions based on the context of the error or issue. For example, if your code produces an error
message or warning, Copilot Chat can suggest possible fixes based on the error message, the
code's syntax, and the surrounding code. The changes might consist of changes to variables,
control structures, or function calls that could resolve the issue.

7 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Propose a fix for failing tests (preview). When you run automated tests for your code, Copilot can
suggest code fixes for tests that fail with the /fixTestFailure command.

• Suggest terminal command fixes. When a command fails to run in the terminal, Copilot displays a
sparkle in the gutter that offers a Quick Fix to explain what happened.

Jumpstart your project


• Generate a new VS Code workspace for your choice of technologies with /new to get started

8 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

quickly with a new project. Pick and choose your technology stack, preview the workspace files, and
let Copilot scaffold the entire workspace for you.

• Scaffold a new Jupyter notebook by using natural language. Generate a new notebook that is
preconfigured based on a description by using /newNotebook . For example, to scaffold a new
notebook that loads, inspects, and visualizes a sample dataset, prompt Copilot with "@workspace /
newNotebook download titanic dataset and display key information using MatPlotLib".

9 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

Generate unit test cases


• Configure your testing framework setup based on your codebase. For example, if you have a
JavaScript and TypeScript project, Copilot will suggest suitable testing frameworks and steps to
configure them for your workspace.

• Write unit test cases for your testing framework based on the code open in the editor or the code
snippet you highlight in the editor. Copilot identifies your testing framework and coding style and
generates matching code snippets.

10 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Identify and write test cases for edge cases and boundary conditions that might be difficult to
identify manually. For instance, Copilot can suggest test cases for error handling, null values, or
unexpected input types.

• Suggest assertions that ensure the function is working correctly, based on the code's context and
semantics. For example, generate assertions to ensure that function input parameters are valid.

Generate code documentation


• Generate code documentation for multiple languages for the code open in the editor or the code
snippet you highlight in the editor. Use /doc or a Copilot smart action to help you generate
meaningful code documentation.

Productivity improvements
• AI-generated commit messages and PR descriptions based on the code changes in a commit or
the changes in a pull request. Use the sparkle button in the Source Control view or GitHub PR
extension to generate a title and description that summarizes your changes.

11 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Ask help in the Command Palette to help you find the relevant command in VS Code. You can
describe the functionality and Copilot can help identify the matching functionality. For example, type
"code preview in scrollbar" in the Command Palette, and Copilot can identify that you're referring to
the editor.minimap settings.

• AI-generated rename suggestions for symbols in your source code. When you rename a symbol in
your code, Copilot suggests a new name based on the context of the symbol and the codebase.

12 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Semantic search results (preview). The Search view lists exact text matches across your files, in
addition to matches that are semantically relevant based on your search text.

• Use terminal Inline Chat to ask questions about the terminal or how to use specific shell
commands. For example, you can ask questions such as "list the top 5 largest files in the src
directory", or "how to enable shell integration".

Next steps

• Get started with the Copilot in VS Code Quickstart (/docs/copilot/getting-started)


• Get started with editing across multiple files with Copilot Edits (/docs/copilot/copilot-edits)

13 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

• Get a quick overview of the Copilot features in VS Code (/docs/copilot/copilot-vscode-features)

Additional resources

You can read more about Copilot and how to use it in VS Code in the GitHub Copilot documentation
(https://docs.github.com/copilot/getting-started-with-github-copilot?tool=vscode).

Or check out the VS Code Copilot Series (https://www.youtube.com/playlist?


list=PLj6YeMhvp2S5_hvBl2SE-7YCHYlLQ0bPt) on YouTube, where you can find more introductory content
and programming-specific videos for using Copilot with Python (https://www.youtube.com/watch?
v=DSHfHT5qnGc), C# (https://www.youtube.com/watch?v=VsUQlSyQn1E), Java (https://www.youtube.com/
watch?v=zhCB95cE0HY), PowerShell (https://www.youtube.com/watch?v=EwtRzAFiXEM), C++ (https://
www.youtube.com/watch?v=ZfT2CXY5-Dc), and more.

Was this documentation helpful?

Yes No

02/06/2025

Subscribe(/feed.xml) Ask questions(https://stackoverflow.com/questions/tagged/vscode)

Follow @code(https://go.microsoft.com/fwlink/?LinkID=533687)

Request features(https://go.microsoft.com/fwlink/?LinkID=533482)

Report issues(https://www.github.com/Microsoft/vscode/issues)

Watch videos(https://www.youtube.com/channel/UCs5Y5_7XK8HLDX0SLNwkd3w)

14 sur 15 19/02/2025 20:40


GitHub Copilot in VS Code https://code.visualstudio.com/docs/copilot/overview

(https://
www.microsoft.com)

(https://go.microsoft.com/fwlink/?LinkID=533687)
(https://github.com/microsoft/vscode) (https://www.youtube.com/@code)

Support (https://support.serviceshub.microsoft.com/supportforbusiness/create?sapId=d66407ed-3967-
b000-4cfb-2c318cad363d)
Privacy (https://go.microsoft.com/fwlink/?LinkId=521839)
Terms of Use (https://www.microsoft.com/legal/terms-of-use) License (/License)

15 sur 15 19/02/2025 20:40

You might also like