Improving GitHub Copilot Completions in VS Code for C++ Developers

Table of Contents
- Introduction
- Improvements in Copilot Completions for C++ Developers
- Example of Enhanced Copilot Completions
- Getting Started
- Future Support and Contacts
Introduction
This article discusses the recent improvements made to GitHub Copilot code completions in Visual Studio Code (VS Code) for C++ developers. It highlights how the integration of directly-referenced header files as additional context enhances the accuracy and relevance of Copilot's suggestions.
Improvements in Copilot Completions for C++ Developers
The update to the C/C++ extension and GitHub Copilot extension in VS Code now includes directly-referenced header files in the context considered for Copilot completions. This enhancement aims to reduce hallucinations and provide more contextually relevant suggestions for C++ developers.
Example of Enhanced Copilot Completions
- Before:
- When directly-referenced header files were not considered, Copilot suggested a non-existent function.
- After:
- With header files considered, Copilot correctly suggested an existing utility function.
Getting Started
To benefit from these enhancements, ensure you have GitHub Copilot extension version 1.205 or later, an active subscription, and C/C++ extension version 1.21 or later with IntelliSense configured correctly.
Future Support and Contacts
The team is committed to C++ Copilot support in Visual Studio and VS Code, with similar improvements coming to Visual Studio 2022 version 17.12. Your feedback is valuable in shaping the Copilot experience for C++ developers; you can provide feedback on GitHub Copilot by opening a GitHub discussion.