Re-imagining developer productivity with AI-assisted tools

Amanda Silver

TL;DR:

Harnessing the wisdom of the community, Visual Studio IntelliCode is revolutionizing developer productivity. We started with AI-assisted IntelliSense and are now expanding the application of artificial intelligence to significantly accelerate learning, radically improve development agility, and increase code quality by means of two exciting new capabilities: whole line completions and refactoring.

Technology is evolving so fast that every developer is constantly learning, whether you’re adopting a new programming language, API, or architecture (e.g. microservices). Amidst this rate of technological change, existing tools are no longer sufficient for achieving agility as development teams are trying to accelerate their time-to-market  and increase code quality. As a result, development tools need to radically evolve to satisfy the productivity demands of modern teams.

At Microsoft Ignite, we showed a vision of how AI can be applied to developer tools. After talking with thousands of developers over the last couple years, we found that the most highly effective assistance can only come from one source: the collective knowledge of the open source, GitHub community. This is exactly what IntelliCode provides.

AI-assisted suggestions + whole-line code completions

IntelliCode now provides whole-line code completion suggestions mined from the collective intelligence of your trusted developer knowledge bases. This is like having an AI-developer pair-programming with you, providing meaningful, suggestions and whole-line code completions without disrupting your flow. To generate accurate suggestions and provide completion assistance as you code, IntelliCode extends the GPT-2 transformer language model for our machine-learning models to learn about programming languages and coding patterns.

The GPT model architecture, originally developed by OpenAI, has demonstrated strong natural language understanding, including the ability to generate conditional synthetic text examples without needing domain-specific training datasets. For our initial language-specific base models, we adopted an unsupervised learning approach that learns from over 3000 top GitHub repositories. Our base model extracts statistical coding patterns and learns the intricacies of programming languages from GitHub repos to assist developers in their coding. Based on code context, as you type, IntelliCode uses that semantic information and sourced patterns to predict the most likely completion in-line with your code.

Suggested whole-line completions in Visual Studio Code editor
AI-assisted whole-line completions in Visual Studio Code editor

 

IntelliCode has now extended our machine-learning model training capabilities beyond the initial base model to enable your  teams to train their own team completions. Team completions are useful if your development team uses internal utility and base class libraries or domain-specific libraries that aren’t commonly used in open-source GitHub repositories. If you’re using code that isn’t in that set of GitHub repos, those recommendations aren’t as useful to you. By training on your team’s code, IntelliCode learns patterns from your code to make more accurate suggestions. This enables your  team to accelerate  learning and take advantage of the knowledge of your team and broader community.

AI-assisted Refactoring

IntelliCode watches code changes as they occur in the IDE and locally synthesizes, on demand, edit scripts from any set of repetitive pattern changes. It uses these edit scripts to produce suggestions, enabling you to apply repetitive changes quickly or create a pull request to apply the suggestion(s) for team review without distracting your current work. IntelliCode refactorings take the time-intensity and error-proneness out of routine tasks, such as introducing a new helper function. To do so, IntelliCode uses an AI technology called program synthesis, and more specifically, programming-by-examples (PBE).

Quick action menu in Visual Studio IDE showing available actions for IntelliCode refactorings. Available actions are take the repeated edit, ignore the suggestion, or submit a new PR with the suggestion.
IntelliCode refactorings based on repetitive code edits in Visual Studio IDE

 

PBE technology has been developed at Microsoft by the PROSE team and has been applied to various products to enable users to streamline repetitive tasks after providing a few examples. You’ve seen PBE in action in Flash Fill in Excel and webpage table extraction in PowerBI. IntelliCode advances the state-of-the-art in PBE by allowing patterns to be learned from noisy traces as opposed to explicitly provided examples, without any additional steps on your part. You can read more about this in this earlier post. We’re planning to broaden this capability to more languages, as well as enabling your team easily benefit from the patterns that you find.

 

Display of IntelliCode refactoring suggestions in Visual Studio IDE
IntelliCode refactorings in Visual Studio IDE

 

What about privacy and code security?

We know that your code is a vital business asset, so we are committed to a simple principle across our developer tools and services: your code remains your code, your models are your models, and remain your models unless you choose to share them with others. You control when to utilize AI-assistance and who has access to your data.

As examples of this principle in action, when we train a team model for IntelliCode completions on your codebase, we don’t share that model with anyone but you unless you choose to share it, and we locally extract only those elements of the code that are needed to create a model for recommending completion values. We also make it easy for you to ensure that access to your model follows the same security access rules as your code repo when shared, with no extra configuration. You can read more about this in the documentation.

Our PROSE-based models work entirely locally, so your code never leaves your machine.

When it is necessary for us to use a service-based model to deliver a feature, we ensure all appropriate security is in place to secure any information (including code) that is transmitted over the network – the documentation has more information.

What’s next? 

Our ambition is to contribute to developer-assistance across the whole developer lifecycle. We’re particularly interested in making learning and retrieving typical code snippets whilst learning a new API or re-learning an old one, a lot easier. We continue to listen hard to our developer community about where we can best contribute to assist with your daily development challenges.

Get the latest Visual Studio 2019 previews; there, you can try much of this out for C# already. Watch the Visual Studio blog for more announcements as we make progress.

You can also sign up for regular updates and invitations to future private previews.

Try it now

You can try out IntelliCode team models and refactorings in Visual Studio for C# by downloading our latest Visual Studio Preview.

We also support a variety of languages in Visual Studio and Visual Studio Code:

  • Visual Studio: C#, C++, JS/TS, XAML
  • Visual Studio Code: Python, JS/TS, Java, SQL

 

Happy coding!

14 comments

Discussion is closed. Login to edit/delete existing comments.

  • Luca Manganelli 0

    To have IntelliCode in VS Code, what should I do?

    • Mark Wilson-ThomasMicrosoft employee 0

      You can get the latest version of the Visual Studio Code extension here: http://aka.ms/vsic/xtn/vscode . Note that the whole line completion and refactorings features shown at Ignite are not yet released ; sign up at https://aka.ms/vsicsignup to be kept up to date as we make progress, and thanks for your interest!

  • hitesh davey 0

    Hi Amanda Silver (“Partner Director Program Manager , Visual Studio and Visual Studio Code”!)

    your blog; the last para says…”We also support a variety of languages in Visual Studio: C#, C++, JS/TS, XAML”. Is VB.NET is no more part of VS2019???
    Why you guys purposely dropping VB.NET in every blog all the time ever since VS2019 was released? This is an insult to the VB.NET developer’s community.
    Ever since VS2002/DotNet 1.0 was released; we have invested so much time, efforts, money, many man-hrs & other resources in training, development & testing variety of mission-critical/realtime business apps developed using VB.NET. Showing such ignorance towards VB.NET is very disappointing!
    You guys are not even willing to correct your past mistakes even after pointing out by many in previous blogs. This attitude confirms VB.NET is on deathbed and you guys at MS doing too little too late in maintaining the most beautiful computer programming language ever developed.

    • Mark Wilson-ThomasMicrosoft employee 0

      Thanks for pointing out the error Hitesh; we do in fact support VB.NET in recent VS2019 builds; you can turn it on under tools options IntelliCode VB.NET.

      Mark

      • hitesh davey 0

        THANK YOU for the reply and solution! If this was not asked we would never know.

        • Mark Wilson-ThomasMicrosoft employee 0

          Thanks hitesh. We’ll make sure that this is correct in future blogs and documentation.
          Regards
          Mark

  • Phillip Mortari 0

    Really excited with that! Can’t wait to put my hands on and start testing!

    • Mark Wilson-ThomasMicrosoft employee 0

      Thanks Phillip. If you are working in C# you can already try out IntelliCode refactorings , and if you sign up we’ll keep you posted on new feature releases as they happen.

      Mark

  • Stevie White 0

    I’ll be interested to try this out when what was shown at Ignite makes its way into the release version of VS. Right now I keep turning off Intellicode because it doesn’t seem to provide any significant difference in what I am getting out of stock Intellisense with some extensions and/or what Rider/Resharper provides.

    • Mark Wilson-ThomasMicrosoft employee 0

      Thanks Stephen. Be sure to sign up at https://aka.ms/vsicsignup to get updates as we release new capabilities. Meanwhile we would love to hear more about the cases where you’d like to see IntelliCode’s completions work and are not seeing any differences – drop me a line at mwthomas at microsoft dot com and we can discuss in more depth?

      Regards
      Mark

  • László Csöndes 0

    In some environments you’re simply not allowed by policy or the law to have your code leave the premises/country/etc. to someone else’s loosely-defined “cloud” that could be anywhere and is outside your control. The article mentions that there’s an offline model, but I’d love to see a guide or documentation on how to ENSURE* that if I use IntelliCode no code will ever get uploaded anywhere. Until that happens we’ve resorted to banning the extension outright, which is a shame because it seems that you’re now tying otherwise unrelated features such as pattern-based refactorings or the ones based on repeated edits to this feature. IC seems to not really work at all when offline, your GitHub issue #102 is somewhat related to this.

    *including any future updates that might get a new feature that defaults to uploads being on. It’s a risk that we simply can’t take.

    • Mark Wilson-ThomasMicrosoft employee 0

      Hi László

      Thanks for your comments and observations.

      To clarify the situation: right now the only way even a summary extraction of metadata for your code will ever leave your machine is if you choose to train a team completions model (formerly called custom models). No other feature does any uploading of code. You can individually disable the team completions feature in Tools-Options-IntelliCode-Preview-C# Custom models (or C# Team Models on more recent builds) if you wish to do so. Is that sufficient or are you looking for a policy means to disable this feature? Feel free to open a new issue if that’s what you’re looking for; that will also allow other interested parties to upvote it.

      In terms of offline operation, you can use IntelliCode completions in Visual Studio as long as you connect the machine online at least once to allow the base completions model to be acquired, Team completions will not work without a connection since training occurs in the service. All other features will work offline (e.g. Refactorings, Editorconfig inference). I understand the issues raised in our issue 102 which is requesting a full offline support – we have nothing to announce there at present but we’re continuing to listen to the feedback.

      I hope this helps – if I’ve missed or misunderstood anything please drop me a line at mwthomas at microsoft dot com

      Thanks
      Mark

  • Alex Nguyen 0

    Any chance this will be coming to F#? Thanks!

    • Mark Wilson-ThomasMicrosoft employee 0

      Hi Alex.
      It’s not on our immediate backlog, but we track feature requests on our GitHub there’s a feature suggestion tracking it here which you can vote up.
      Thanks!
      Mark

Feedback usabilla icon