Improved GitHub Copilot suggestions for C# developers in Visual Studio
With the ever-increasing automation of the programming process, GitHub Copilot is becoming an indispensable tool for many developers. As an intelligent, AI-based code assistant, Copilot offers autocomplete suggestions while writing code. However, as with any tool, there is still room for improvement. Microsoft has taken a significant step with the latest version of Visual Studio 2022 (version 17.11) to considerably improve GitHub Copilot's code suggestions for C# developers.
Relevant context for more precise suggestions
Previously, Copilot's functionality relied on generating suggestions based on the current code and other open files in the editor. However, this meant that important information from files that weren't open was not included in the suggestions. This occasionally led to incorrect suggestions, especially when methods or types were defined in external files.
The latest update significantly improves this: Copilot now also considers semantically relevant files that are not open. This means the tool can access a broader context base and therefore makes more precise suggestions that better match the actual code.
Fewer errors thanks to improved context
Including these relevant files helps reduce incorrect or inappropriate suggestions. Copilot now offers more reliable and accurate completions by better understanding the developer code and the surrounding codebase. This improvement is especially useful when working on complex projects where many different files and methods interact.
A look ahead at future improvements
Microsoft plans to integrate these improvements not only into Visual Studio, but also into VS Code soon, so that even more C# developers can benefit from the more precise suggestions.

