Visual Studio IntelliCode – AI For your Code
Tags: programming
Published: 2019-06-04 07:42:08

---
title: Visual Studio IntelliCode – AI For your Code
published: true
tags: Programming
canonical_url: https://dirkstrauss.com/visual-studio-intellicode/
---

Visual Studio IntelliCode allows you to add the power of artificial intelligence to your code. Enabling IntelliCode is super easy, and I’m going to show you exactly how to do this.

## LOOKING FOR SOMETHING ELSE? TRY THESE LINKS INSTEAD:

- [Extension Methods Are Easy with C#](https://dev.to/dirkstrauss/extension-methods-are-easy-with-c-235d)
- [Struggling With Imposter Syndrome? How To Think And Overcome](https://dirkstrauss.com/struggling-with-imposter-syndrome-think-overcome/)
- [Flexible Working Hours – You Can Work From Home!](https://dirkstrauss.com/flexible-working-hours/)
- [Improve Code Skills? Consider Blogging](https://dirkstrauss.com/improve-code-skills-consider-blogging/)
- [Automate Trello using DevOps and Wunderlist](https://dirkstrauss.com/automate-trello-using-devops-wunderlist/)

If you are a bit short on time, go and check out the video explainer on this topic.

<iframe type="text/html" width="640" height="360" src="https://www.youtube.com/embed/G6cqkzEJx-g?version=3&amp;rel=1&amp;fs=1&amp;autohide=2&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent" allowfullscreen="true" style="border:0;"></iframe>

This should get you up to speed quickly enough. If you enjoy the video, please consider subscribing to the channel and giving the video a thumbs up.

## Visual Studio IntelliCode Explained

IntelliCode is a super exciting addition to Visual Studio. [Microsoft calls it AI-assisted development](https://visualstudio.microsoft.com/services/intellicode/). It will save you time by putting what you are most likely to use at the top of your completion list. These are displayed as starred recommendations.

![Suggestions based on code context](https://i1.wp.com/dirkstrauss.com/wp-content/uploads/2019/06/intellicode.png?w=640&ssl=1)

IntelliCode uses open source GitHub projects with 100 stars or more to generate recommendations for your code. IntelliCode will also build a custom model to provide recommendations from your source code. These are things such as methods from your own classes or domain specific library calls.

Note: IntelliCode features are off by default. To enable these, go to **Tools** > **Options** > **IntelliCode** and enable the features.

![Visual Studio IntelliCode features are off by default](https://i2.wp.com/dirkstrauss.com/wp-content/uploads/2019/06/intellicode-options.png?w=640&ssl=1)

This will enable IntelliCode for your project.

## Install Visual Studio IntelliCode

If you don’t have IntelliCode installed, head on over to the **Extensions** > **Manage Extensions** window to download and install it.

![Installing from Manage Extensions](https://i0.wp.com/dirkstrauss.com/wp-content/uploads/2019/06/intellicode-installation.png?w=640&ssl=1)

After downloading, you will need to restart Visual Studio in order to install IntelliCode.

## Building an IntelliCode Model

In Visual Studio 2019, hit **Ctrl+Q** and type **IntelliCode** into the search window. Select **IntelliCode Model Management** from the results or go to **View** > **Other Windows** > **IntelliCode Model Management** to access the Visual Studio IntelliCode window.

![Visual Studio IntelliCode Model Management](https://i2.wp.com/dirkstrauss.com/wp-content/uploads/2019/06/visual-studio-intellicode.png?w=640&ssl=1)

From here, you can build IntelliCode models for your projects. You can see the models shared with you, share the model you just built, retrain or delete the IntelliCode model.

## Can I Use it in My Code?

At the time of this post, IntelliCode works in Visual Studio 2017 (version 15.8 and up) as wella s Visual Studio 2019. It also supports the following languages:

- C#
- C++
- XAML (In Visual Studio 2019)

IntelliCode also works in Visual Studio Code and supports:

- Python
- TypeScript
- JavaScript
- Java

Microsoft is bringing the goodness of AI to Visual Studio Code. Now that is really neat!

## View Extracted Data

After you have generated your model, you can head over to the following folder:

```
 %TEMP%\Visual Studio IntelliCode 
```

Here you should see a **UsageOutput** folder in one of the created folders. Look for a usage JSON file. This is the contents of the extracted data. Code analysis all happens client side. This data extraction is then fed into Microsoft’s Model Service which is uploaded to the service in the cloud.

It is important to note that Microsoft doesn’t receive any of your code. It only uploads data and information about your code. So your code remains on your machine.

## Get the Source Code

If you want to grab a working example of the code used in this blog post, head on over to the following GitHub repo and clone the repo to your local machine.

[dirkstrauss/IntelliCodeDemo](https://github.com/dirkstrauss/IntelliCodeDemo)

If you have any comments or suggestions, please feel free to put those in the comments section below. Give it a try, and see what IntelliCode can do for you!

The post [Visual Studio IntelliCode – AI For your Code](https://dirkstrauss.com/visual-studio-intellicode/) appeared first on [Programming and Tech Blog](https://dirkstrauss.com).