What is Visual Studio IntelliCode?
Visual Studio IntelliCode is an AI-assisted development feature from Microsoft that enhances the coding experience within Visual Studio and Visual Studio Code. Trained on thousands of high-quality, open-source GitHub repositories, IntelliCode goes beyond traditional autocompletion by providing context-aware code suggestions, helping developers write better code, faster. It acts as an intelligent assistant, predicting the most likely methods and properties a developer needs based on the current coding context.
Key Features
- AI-Assisted IntelliSense: IntelliCode enhances IntelliSense by starring the most relevant completion items at the top of the list, saving you time from scrolling through alphabetical lists.
- Whole-Line Completions: It predicts and suggests an entire line of code, allowing you to accept the gray-text prediction with a single keystroke. This is available for C#, Python, JavaScript, and TypeScript.
- API Usage Examples: Provides real-world examples of how to use specific functions, drawn from public open-source projects, helping you understand API usage without leaving the IDE.
- Argument Completion: Suggests the most likely arguments as you type a method call, reducing the need to look up function signatures.
- Repetitive Edit Detection: Identifies repeated edits and suggests applying the same change to all similar locations in your code, automating refactoring tasks (C# only).
Use Cases
- Accelerated Development: Speed up daily coding tasks by accepting intelligent, whole-line suggestions.
- API Discovery and Learning: Quickly learn new libraries and frameworks by seeing contextual examples and the most common API calls.
- Improved Code Quality: Reduce errors and improve consistency by using suggestions trained on best practices from popular open-source projects.
- Efficient Refactoring: Automate repetitive code changes across your file, ensuring consistency and saving manual effort.
Getting Started
Getting started with IntelliCode is simple as it’s built directly into Microsoft’s development environments.
For Visual Studio: IntelliCode is included by default in most workloads. Simply open a project in a supported language (like C#) and you will start seeing starred suggestions in your IntelliSense list.
For Visual Studio Code:
- Navigate to the Extensions view (
Ctrl+Shift+X). - Search for “IntelliCode”.
- Click Install on the extension provided by Microsoft.
- Once installed, it will automatically activate for supported languages (Python, TypeScript/JavaScript, Java).
For example, when typing in a C# file, you might see:
```csharp
List
Pricing
Visual Studio IntelliCode is free. It is included with all editions of Visual Studio (including the free Community edition) and is available as a free extension for Visual Studio Code.