If you’re a .NET developer, now is the perfect time to try GitHub Copilot. This AI-powered coding assistant is built to boost your productivity by offering intelligent code suggestions, efficient error resolution, and concise code summaries. Available for both Visual Studio and VS Code, Copilot’s latest updates deliver focused tools tailored specifically for .NET, making your workflow smoother and more efficient. Here’s how you can maximize these features for .NET development.
Accessing GitHub Copilot
To get started with GitHub Copilot, you’ll need a GitHub Copilot subscription.
Getting Started in Visual Studio
In the latest versions of Visual Studio 2022, GitHub Copilot is pre-installed, making setup quick and easy. For earlier versions, you can manually install the extension.
Getting Started in VS Code
In VS Code, ensure both the GitHub Copilot and C# Dev Kit extensions are installed. Installing the GitHub Copilot extension also installs the GitHub Copilot Chat extension.
Code Faster with GitHub Copilot’s Inline Suggestions
GitHub Copilot offers autocomplete suggestions inline as you code. These suggestions are generated based on the content in your active file and other open files in your editor. In the latest version of Visual Studio 2022, Copilot now references semantically relevant files to provide additional C# context, even if those files aren’t open. This enhancement reduces irrelevant suggestions and improves accuracy. Similar improvements are coming soon to VS Code, ensuring that your inline suggestions align even more closely with your coding needs.
If a suggestion is close to what you want but not completely correct, you now have more control over Copilot’s suggestions. Instead of merely accepting or ignoring a suggestion, you can now modify and retry it, allowing you to fine-tune suggestions by adding context or making tweaks.
Understand Symbols Right from Your Editor
GitHub Copilot can now help you understand various symbols at different invocations within your codebase, right from your editor. Use the Generate Copilot summary to get AI-generated descriptions of your selected code.
Fix Code with GitHub Copilot
Now integrated into the lightbulb and error list, GitHub Copilot provides fixes and explanations for code issues, helping you understand and resolve them within your codebase. By invoking the lightbulb and selecting Fix with Copilot, Copilot opens an inline chat with a suggested fix. Additionally, selecting the Copilot icon from the error list takes you to the chat panel with an explanation and available fix.
Test with GitHub Copilot
When your unit tests fail, troubleshooting the failure can be challenging. Now, in Visual Studio, GitHub Copilot can explain the test failure or assist with debugging. Debug with Copilot will create a debug plan, set breakpoints, identify important variables to watch, and kick off a debug session. It will then guide you through the session, helping you continue debugging or pinpoint a fix for your failing test.
Submit Your PR with GitHub Copilot
Writing good pull request descriptions is essential for effective code reviews and collaboration. When you’re ready to submit your PR, use GitHub Copilot’s generated pull request descriptions. Copilot examines your code changes and generates helpful summaries that you can edit and customize. Save your energy for coding tasks and let GitHub Copilot provide extra context for your reviewers.
Getting Started Resources
To get the most out of GitHub Copilot for .NET development, explore these tailored tutorials:
- Getting Started with GitHub Copilot for .NET in Visual Studio – Watch the introductory video to learn how to use key features specific to .NET development in Visual Studio.
- Getting Started with GitHub Copilot for .NET in VS Code – Discover how to set up and optimize GitHub Copilot specifically for .NET projects in VS Code.
I have 2 questions here.
1) Full-line completion uses local model as described here: AI assistance when you write code. Which is okay for me, because I don't want my code to be sent to some black-box over the internet.
But you're now saying that it is actually preinstalled Github Copilot that make these completions. As I understand, this implies sending my code over the network. Could you, please, clarify this moment?
2) In Copilot FAQ it...
Please stop with this AI garbage. I had inline suggestions on on a new VS 2022 installation and it got predictions wrong about 95% of the time, while making it very distracting to write code. The only good thing with the Copilolt branding is it’s very easy to know which feature to disable immediately.