In this tutorial, we will explain how to install “GitHub Copilot” and “Copilot Chat” AI tools in VS Code and use to increase productivity.
In the current era of Artificial Intelligence (AI), we are experiencing widespread integration of AI in various sectors. It creates many challenges in each fields to human resource to improve productivity to survive in their fields.
For programmers, there are many challenges occurs to speedup code writing and improve productivity using AI tools. So here we will explain how to use the GitHub Copilot AI tool in your Visual Studio Code Editor (VS Code) to write code faster.
GitHub Copilot is an AI coding assistant for programmers to write code faster and with less effort. It also helps to write code as per our need by using chat suggestions.
What is GitHub Copilot?
GitHub Copilot is an free AI tool from GitHub to help to write code easier and faster. In Copilot Free you have access to Anthropic’s Claude 3.5 Sonnet and OpenAI’s GPT-4o models.
GitHub Copilot offers coding suggestions as well as respond to natural language to provide code in your coding environment. For example, writing a function to validate email address, write code to send an email in php – Copilot generates more than one code for you, and you can choose which one more suitable.
How to Install GitHub Copilot
To use GitHub Copilot, you need to enable Copilot in your GitHub account settings. Just choose GitHub Copilot on the left menu and allow it, then click the Save button.
Now open Visual Studio Code and go to the Extensions. Search for “GitHub Copilot” in the search bar. Install GitHub Copilot and restart your Visual Studio Code.
To install Copilot Chat, open Visual Studio Code and go to the Extensions. Search for “GitHub Copilot Chat” in the search bar. Install it and restart your Visual Studio Code.
How to Use GitHub Copilot
The Copilot will start working to generate code as per provided description. For example, let’s create a function to validate email address in JavaScript.
In a JavaScript file, simply write a comment like “generate function to validate email address”
// generate function to validate email address
Then press enter. It will write the function to validate email address.
// generate function to validate email address function validateEmail(email) { var re = /\S+@\S+\.\S+/; return re.test(email); }
How to Use GitHub Copilot Chat
You can use GitHub Copilot Chat to send and get inline response for your queries. You just need to press Ctrl+I key to open inline chat view and start to send a chat request to Copilot directly from the editor. The code responses are displayed as suggestion to accept or discard.
Here is GitHub Copilot Chat view displayed to enter query and get response to accept or discard it:
Conclusion
In this tutorial, you have learned about GitHub Copilot and GitHub Copilot Chat AI Tools in VS Code. You can also search try other AI extensions in VS Code to speedup your coding and productivity. Don’t forget to share in comment box if get any. Thanks!