On top of all the Visual Studio announcements at Ignite 2019 in Orlando today, Microsoft also shared some notable improvements to Visual Studio IntelliCode, which uses AI to offer intelligent suggestions that improve code quality and productivity. IntelliCode now supports whole-line completions and features dynamic refactoring detection. This is a continuation of Microsoft’s strategy of applying AI “to the entire application developer lifecycle.”

IntelliCode is trained on over 14,000 public code repositories to understand how APIs are used. But Amanda Silver, a director of Microsoft’s developer division, told VentureBeat that IntelliCode can now learn from your own code, too.

“In addition to learning from the public repos on GitHub, we’ll also be able to learn from keystrokes as you type,” Silver told VentureBeat. “The keystrokes as you type [are] not being sent back to Microsoft or anything like that. We’re basically learning on your machine so that we can actually take the repetitive and the tedious tasks and create a refactoring that you can invoke immediately in the context of your code. This isn’t a traditional refactoring that you might be used to, where we have a semantic understanding of the code base and it’s all based on static analysis. This is actually looking at, dynamically, the keystrokes that you’ve been typing, plus the context of the code that you’ve been writing, to create new refactoring suggestions.”

Whole-line code completions and dynamic refactoring detection

If you’ve ever used Microsoft Excel, you might be familiar with Flash Fill. When Excel spots a pattern in the data you are entering into cells, Flash Fill makes a suggestion for what the next set of cells should be. “We’re actually using the same base technology, but now for code,” Silver said.

VB Transform 2020 Online - July 15-17. Join leading AI executives: Register for the free livestream.

Until now, IntelliCode would suggest the best prediction for which overload or which API you were going to call next. “We’re getting to the point where we have whole line completion,” Silver declared. IntelliCode can complete the entire line of code that you need to write, including the arguments that you need to pass in. Instead of typing out 40 or 50 characters, you can type out those same characters in, say, five keystrokes.

Additionally, IntelliCode has largely been focused on C#, C++, and TypeScript — statically typed programming languages. Over the past few months, however, the team has used unsupervised machine learning techniques to create a model that is predictive for Python.

“So the result is that as you’re coding Python, it actually feels more like the editing experience that you might get from a statically typed programming language — without actually having to make Python statically typed. And so as you type, you get statement completion for APIs and you can get argument completion that’s based on the context of the code that you’ve written thus far.”

Visual Studio’s refactoring functionality is also getting better, with dynamic refactoring detection. The new IntelliCode option now lets you save suggestions for later. “We will be able to extract that out into a PR that you could accept at a later time. This allows you to essentially shelve that refactoring so that you can come back to it as a pull request later.” In other words, this is Microsoft’s latest move to integrate GitHub further into its stack.