Introducing Visual Studio IntelliCode
Visual Studio IntelliCode brings you the next generation of developer productivity by providing AI-assisted development. Every keystroke and every review is informed by best practices and tailored to your code context. You can try it out today by downloading the experimental extension for Visual Studio 2017 that provides AI-powered IntelliSense.
What is IntelliCode?
IntelliCode is a set of AI-assisted capabilities that improve developer productivity with features like contextual IntelliSense, inference and enforcement for code styles, and focused reviews for your pull requests (PRs.)
AI-assisted IntelliSense, and the other features shown at BUILD 2018, are just the start. Over time you’ll see more ways that we’ll assist your end-to-end developer workflow.
Check out this video for a demo of some of the capabilities IntelliCode will offer.
What can IntelliCode do now?
As you type, AI-assisted IntelliSense recommends the most likely API. This makes it easier to learn a new API and dramatically reduces the number of keystrokes required to complete a line. With more context from the code you write, IntelliSense becomes more accurate.
IntelliCode’s improvements are not just about statement completion. IntelliCode also provides guidance as to the most appropriate overload for that API given the current code context. No more extraneous scrolling!
AI-assisted IntelliSense: better recommendations with every keystroke
How does it work?
IntelliCode generates recommendations by using a machine-learning model that is trained on thousands of public codebases – today it uses over 2000 GitHub repos that each have more than 100 stars to ensure that you’re benefiting from best practices. The model is used in your IDE along with your local code context to provide .NET related APIs that are likely to be the most relevant for you given the line of code you’re writing. We’ll be growing and improving the model over time so the recommendations will get better as we progress.
While it’s still very early, you can download and experiment with this capability in the IntelliCode extension right away. We welcome your feedback.
Beyond what is currently in our experimental extension, here are a few of the things IntelliCode is experimenting with. Right now, the extension is only C#, but we want to expand to other languages later.
Automatic definition of styles and formatting: no more style inconsistencies
Consistency is important for maintainability; in fact recent research shows that 18% of PR comments are related to coding conventions, styles and naming issues.
IntelliCode can automatically generate an .editorconfig file that best matches your current styles and formatting. Once generated, this file will help you maintain consistency in your code. Fixing up formatting issues is a snap with existing lightbulbs or with a new, code-cleanup command.
Assisting with every review
As developers, you know that code reviews can be time consuming. It’s challenging to focus on the right things when other issues get in the way. IntelliCode makes reviews less painful for everyone by providing focus for the reviewer, and an automated, first-level review.
Find misused variables
With automatic generation of comments in files for potential issues, you’ll be able to identify and fix issues faster. For example, IntelliCode can detect variable misuse, often introduced through copy/paste where a variable is of the correct type but used in the wrong context. These analyses go beyond style concerns or what a conventional static analysis tool can find – it can find actual bugs in your code. It’s discovered bugs in our code too!
Get recommendations for files to review
IntelliCode focuses your reviews by indicating which files may need extra attention. These recommendations are based on machine-learning heuristics for the history of the files, their dependencies, the code complexity and history. These capabilities can be applied alongside CI analysis services and other code review processes. The results can be surface in the IDE and in web-based tools. For example, review comments generated by the IntelliCode analyzers can appear in your online Visual Studio Team Services’ pull requests (PRs).
Some of IntelliCode’s analyzers use machine-learning on public codebases, and are then specialized to your own repository. When these analyses become available, they will require a sign-up and registration process.
Millions of repos of code are now available in the public domain. This code represents a tremendous amount of knowledge that can be accessed at your fingertips, tailored to your context.
Microsoft is investing extensively in machine-learning and AI technologies. We’re working with Microsoft Research to leverage the latest techniques to learn from source code and deliver new, innovative ways to enhance the coding life of developers, so that you can deliver your software with greater confidence and velocity.
We are excited to give you an early glimpse into IntelliCode, which is currently optimized for C#. Although we are sharing some of it today in an IDE extension (download) you can try right away, today’s demo is just a hint into what’s coming soon.
As we expand the capabilities to more scenarios and other languages, we’ll announce a limited preview of IntelliCode. If you want to learn more, keep up with the project, and be invited to the private preview please sign up!