Introduction to Intellicode in Visual Studio
Most of us are already spellbound by the recent progress made in the world of artificial intelligence. Its applications in various fields like healthcare, transport, manufacturing, etc. have transformed the way we go about our lives.
The programming world is no exception. AI has crept its way into various categories of this industry and has started creating a major impact.
One such unique application, a raging phenomenon happened in 2017. Microsoft had announced a new feature that was capable of predicting the ways to complete a code.
Blended with AI, this feature was capable of saving your precious time by intelligently evaluating your code patterns and suggesting texts that are to be included in your code.
Yes, we are talking about Intellicode in Visual Studio. Let us probe further into this feature and understand how it works.
Table of contents
- What is Intellicode?
- Benefits of Intellicode
- How to set up Intellicode
- Wrapping Up
What is Intellicode?
Intellicode was introduced by Microsoft to enhance the existing Intellisense that provided code completion and autocompleting tips. It comes as a Visual Studio marketplace extension.
The supported languages for Intellicode are
Intellicode was one of the reasons why Microsoft acquired Github in 2018. By having access to thousands of high-quality software projects in Github, Microsoft was able to train its Intellicode AI to provide smart contextual recommendations.
In fact, Github projects that have acquired more than 100 stars are used to train the Intellicode AI. Though this machine learning model is trained with thousands of public codebases,it is continually learning through your own local code as well. This ensures that the recommendations are dependent on your code patterns as well.
Benefits of Intellicode
- The incorporation of Intellicode in your IDE dramatically reduces the keystrokes, thereby saving you time.
- Intellicode aids in code refactoring as it comes up with tailored edit suggestions and refactors your code accordingly.
- It helps to follow your code patterns and styles consistently. To stay on track within your code style, Intellicode derives insights from your local codebase and the patterns generated from it.
- It offers error-free code suggestions eliminating any discrepancies in your code.
- Instead of giving mere alphabetical order of code completion texts, it is the next generation of Intellisense, deducing the right API for the developer to use considering the current code context.
- It catches difficult and low visibility code issues.
- It focuses on code reviews by drawing attention to areas that matter the most.
- It guides developers to adhere to the style of their teams. This ensures that the code can be interpreted by every team member easily.
How to set up Intellicode?
Intellicode is only supported in Visual Studio 15.8 and above. So ensure that your Visual Studio is updated. You can check for the latest updates by clicking on Help > Check for updates in your Visual Studio interface.
After updating to the latest version, you now have to install the Intellicode extension. Navigate to Extensions-> Manage Extensions and search for Intellicode in the Extension Marketplace. Once you find it, click install and proceed. After installing, you must restart your Visual Studio to experience the new changes.
You can also download Intellicode directly from the official site of Microsoft. Open the VSIX downloader that has been downloaded, click on the Install button to install Intellicode in your Visual Studio.
After successful installation, open an existing project or create a new one. Navigate to View > Other Windows >Intellicode Model Management to start experiencing the power of Intellicode.
Intellicode helps you train your existing codebase. Your code patterns can be incorporated into other projects too. The advantage is that you can share your model with friends and colleagues. Training the model helps you generate automatic code tips and autocompletes on the go. Intellicode also provides you with ‘retrain’ options to train your shared model again by identifying new patterns.
The time to finish the model training is dependent on the complexity of the codebase. After successful completion, Intellicode is on track to provide “starred” values which are the automatic code completion suggestions coming from Intellicode.
As you can see in the below image, the starred values are provided by Intellicode along with the syntax and previous usage pattern of the same code.
Unfortunately, Visual Studio does not support its own training model. You have to create custom models to train your current codebase. However, you can create team models and share these custom models with your teams to make them keep track of repository changes.
Microsoft developers are trying to extend the deep learning model of code completion to more languages, while also trying to achieve even longer code completions. Intellicode has proved to be one of the most fruitful approaches for code completion among developers. Besides saving time, it has been instrumental in identifying complex bugs and code issues, allowing developers to follow standard code patterns during the entire project.