Introduction to Intellicode in Visual Studio

23 June 2021 at 10:00 by ParTech Media - Post a comment

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

  1. What is Intellicode?
  2. Benefits of Intellicode
  3. How to set up Intellicode
  4. 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

  • C#, C++, XAML, Javascript, Typescript, and Visual Basic in Visual Studio 2019 and above versions
  • Java, Javascript, Typescript, SQL, and Python in Visual studio code.

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

  1. The incorporation of Intellicode in your IDE dramatically reduces the keystrokes, thereby saving you time.
  2. Intellicode aids in code refactoring as it comes up with tailored edit suggestions and refactors your code accordingly.
  3. 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.
  4. It offers error-free code suggestions eliminating any discrepancies in your code.
  5. 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.
  6. It catches difficult and low visibility code issues.
  7. It focuses on code reviews by drawing attention to areas that matter the most.
  8. 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?

Step 1

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.

Step 2

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.

Step 3

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.

You can also enable/disable Intellicode autocomplete features for specific languages you are working in. Right now, Intellicode only supports C#, Javascript, and Typescript. You can enable/disable Intellicode features by navigating to Tools >Options>Intellicode and customizing the settings as shown in the following image.

Wrapping Up

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.

Latest