This is a WIP community resource, containing contribution from community members.
GitHub Copilot is an AI Tool that is well-integrated with VS Code, because both tools are from the same parent company (Microsoft).
If you have not enabled Copilot in your GitHub account, follow the guide in the panel below:
Help
→ Check for Updates
.Help
→ Restart to Update
.Install
button on the page that opens.Open Visual Studio Code?
and click Open Visual Studio Code
.Install
to install the extension.Sign in
in the pop up.Open Visual Studio Code?
and click Open Visual Studio Code
.File
→ New File
or / Ctrl+N
| Cmd+N
.To get Copilot to complete code based on a comment:
// print Hello World
inside the main method.public class Main {
public static void main(String[] args) {
// print Hello World
}
}
Tab
to accept the suggestion, or continue typing to refine it.To disable automatic code completion,
All files
disables code completion for all files, while the checkbox below it disables code completion for the currently open file type.)If you have access to Copilot Pro, you can also monitor your Copilot Premium Requests usage here.
Open the Copilot Chat using / Ctrl+Alt+I
| Cmd+Alt+I
or using the Copilot icon.
Ask something like: "Write a main method that calculates the factorial of N".
Copilot will generate a response in the chat window.
You can directly insert or copy code chunks using the buttons in the top right corner.
From left to right: Insert automatically into the current file, Insert at cursor, Copy to clipboard.
The Copilot Chat interface also contains a variety of useful features.
@
followed by the participant's name, or clicking on the @
icon. This allows you to invoke certain chat participants that are optimized to answer questions about their respective domains. One useful mention is @workspace
, which answers questions about your entire repository.Ctrl+I
| Cmd+I
.Enter
.accept
.Ctrl+I
to bring up Copilot’s terminal prompt input.Some common project-related prompts you might find useful:
Contributors: Norbert Loh (@NorbertLoh ), Luoqi Xu (@Luoq1-Xu)