Custom AI-Assisted IntelliSense for your team
As you’ve been editing code, you may have noticed IntelliCode’s starred recommendations in your autocompletion lists. Our previous IntelliCode blog post explains that these smarter suggestions were machine-learned over thousands of open sourced GitHub repos. Using community knowledge is great for public APIs like the Standard Library, but what if you want IntelliCode suggestions for your APIs and other libraries that wouldn’t commonly be found in open-source code? To address this, in Visual Studio 2019 version 16.5 Preview 3 you can now train custom IntelliCode models on your own codebases. This generates something we call a “Team Completions model,” because you’ll start to get suggestions based on your team’s coding patterns.
Team Completion model training is a Preview Feature. We look forward to your feedback as we continue to iterate. Currently, the training results may vary depending on the complexity of your configuration and platform settings.
How do I create and use my own model?
First, ensure that “C++ team models for completions” is Enabled under Tools > Options > IntelliCode > General > Preview Features. The simplest way to train and test out a model is via View > Other Windows > Train IntelliCode Model for this Repository. This will instantly start training a model on your codebase. After training, your first member list invocation will load your new Team Completions model, and subsequent invocations will begin to use the new model.
Anyone who has access to the repo will automatically get the model when they open the repo. This way your whole team can benefit without everyone needing to individually train a model.
Note that we don’t upload your raw source code to our servers. You can learn more about what happens when you train a model in our FAQ.
Manually retraining your model
You shouldn’t need to retrain your model often. You’ll benefit from retraining if you’ve made significant code changes that you’d like to be reflected in IntelliCode’s recommendations. In the case that you do want to retrain, you can go through the same manual process from the section above.
Automatically creating and retraining a model via Azure Pipelines
If you don’t want to have to think about retraining, you can automatically create and retrain a model as part of your continuous integration pipeline in Azure Pipelines. You’ll need to install the Visual Studio IntelliCode Team Model Training task from Visual Studio Marketplace to your Azure DevOps organization or Azure DevOps Server. This way, when code changes are pushed to your repo, the build task runs and your team completions model is retrained. For more detailed instructions, please follow this document on configuring and automating the build task.
Give us your feedback
Download Visual Studio 2019 version 16.5 Preview 3 today and give it a try. We’d love your input as we continue to improve Team Completions for C++. We can be reached via the comments below, email (email@example.com), and Twitter (@VisualC). The best way to file a bug or suggest a feature is via Developer Community.