August 7th, 2024

GitHub Copilot Extensions for C++ developers and beyond now available in VS Code

Sinem Akinci
Product Manager II

GitHub Copilot is now more extensible than ever for extension authors in VS Code.

At the Microsoft Build conference, we announced that VS Code extensions can now leverage APIs for Copilot to build custom chat participants that users can interact with in the GitHub Copilot Chat view in VS Code. To learn more, please watch the Build session on the new extensibility and read more on the VS Code blog.  Some notable extensions that have developed chat participants for public consumption include Microsoft Dev Box and Parallels.

Another API that extensions can leverage LLMs with is the language model API. It enables you to integrate AI-powered features and natural language processing in your Visual Studio Code extension. To learn more about this API, please visit our VS Code docs.

What are chat participants?

You can read more in the VS Code docs for more specifics on how chat participants work. These are specified by the user in the Copilot chat window, with queries using @<participant>.

@Cat chat participant providing a description of pointers in C++ in cat speak

Some existing chat participants available in VS Code Copilot Chat that you may be familiar with include @workspace and @vscode.

For example, @workspace dynamically looks at all the code in your open workspace to provide relevant code snippets as context to Copilot Chat.

Invoking @workspace to query a codebase for where the tests are located

On the other hand, @vscode dynamically indexes VS Code settings to provide an answer.

Using @vscode to ask VS code how to specify a specific cmake executable to use in project

With the latest release, you now have access to build your own chat participant for your VS Code extensions, allowing you to provide domain knowledge to Copilot that would be relevant to your users.

As a consumer, there are some chat participants to look forward to that utilized this API and are in the pipeline. For example, for users who have containerized development, there is a Docker Copilot extension that is currently in limited public beta that allows users to learn more about containerization with regards to their app.

What are language models?

With the Language Model API, you can directly access and take advantage of LLMs contributed by GitHub Copilot in your own extensions, by specifying prompts, relevant context, and how requests should be sent to the model. You can utilize this API to enhance developer experiences beyond the Copilot Chat view.

For example, one feature that utilizes the Language Model API is AI-powered rename suggestions, that allow you to dynamically rename symbols in your C++ code. These will automatically invoke suggestions when you go to rename a symbol in VS code when you have the Copilot Chat extension installed.AI-generated rename suggestions for a variable named "property"

Additionally, the source control view utilizes the Language Model API to prompt how to automatically generate commit messages using AI for users that invoke it, based on the source code changes.

AI-generated commit message detailing updates to main.cpp in the soure control view in VS Code

What’s next in VS Code Copilot Chat?

We are committed to enhancing the extensibility, quality, and customizability of Copilot Chat in VS Code. Stay tuned for exciting updates to make your experience with Chat.

Some things coming up to look forward to in VS Code, which can be found in the original blog post announcement from the VS Code team, include the variable resolving API, which allows extensions to contribute chat variables (via # sign) which provide context from the extension’s domain. Additionally, VS Code expects improvements to intent detection, so that these chat participants are automatically invoked, and to provide GPT-4o language model support.

Please file any issues or feedback in the VS Code Copilot repo, try out building your own developments using Copilot for your extensions, or let us know any VS Code extensions you’d like to see leveraging these APIs.

To learn more about using GitHub Copilot in VS Code with C++, watch our introduction YouTube video and others on the VS Code Channel.

Author

Sinem Akinci
Product Manager II

C++ Product Manager working on Copilot, CMake, and Linux experiences in Visual Studio and VS Code

0 comments

Discussion are closed.