DEV Community

Cover image for Visual Studio Intellicode
Fernando Sonego
Fernando Sonego

Posted on

Visual Studio Intellicode

At the Build 2019 conference, Microsoft announced the release of Intellicode. This tool based on artificial intelligence will help us developers while we are developing code. Intellicode is responsible for analyzing millions of lines of code coming from public GitHub projects to provide the best options for our projects and increase their quality, also, it does not give the ability to be more productive.

It supports the following languages in Visual Studio 2019:

  • C#
  • Java
  • Python
  • SQL Server
  • TypeScript / Javascript
  • XAML

Sure you wonder how it works? Intellicode analyzes millions of lines of code sourced from high-scoring public GitHub repositories. While we are writing our code, Visual Studio will show us the recommendations differentiated with a star, let's see the image:

Visual Studio IntelliCode

In the image we can see how when writing our code the suggestions related to the context of what we are doing are displayed. In our context, that of the example, in the recommendations we see the most used options at the beginning of the list marked with a star.

This technology is based on GitHub line learning models. But we can create our own models for our projects. This allows us to customize our project adapting to our work team. The tool will analyze our projects or solutions, automatically generating recommendations.

Visual Studio IntelliCode

Another interesting feature is Code Styles. This functionality allows us to have code conventions to automatically make style and format corrections. It will help us keep our code clean and organized. For this we must add the file editorconfig. This file will contain the necessary information on the basic styles that we can then configure as we wish.

Visual Studio IntelliCode

All the recommendations configured in these files can be seen in the error list window in Messages.

Visual Studio IntelliCode

Let's do a simple test. We will change in our editorconfig file that our indentation instead of being 4 spaces is 15. We will only have to change this line.

indent_size = 4 to indent_size = 15

After saving our file, we will return to our code and press the Ctrl K + D keys to activate the automatic style adjustment. We will see how the indentation changes in our code.

Visual Studio IntelliCode

Conclusion

Over time, more and more languages will be added, providing greater support to the tool. Intellicode will be a very helpful tool for programmers, being able to reduce a large number of common errors, maintain a clean, orderly and consistent code almost by the hand of an automatic refactoring.

Top comments (0)