News

Visual Studio's AI-Assisted IntelliCode Now Infers and Enforces Coding Conventions

Visual Studio's AI-assisted IntelliCode is getting smarter: It now infers coding conventions by scanning existing code, and lets you know when new code violates those conventions.

IntelliCode was introduced in preview at Microsoft's Build conference in May, putting artificial intelligence to work to improve the existing IntelliSense that provides code completion tips.

It comes in a Visual Studio Marketplace extension and leverages machine learning to provide several benefits, including contextual IntelliSense, inference and enforcement for code styles and focused reviews for pull requests.

On the code style enforcement front, Microsoft just updated the extension with more intelligence, providing coding convention inference for C# code.

An .editorconfig File Generated by IntelliCode
[Click on image for larger view.] An .editorconfig File Generated by IntelliCode (source: Microsoft).

"With this update, the IntelliCode extension can now generate an .editorconfig file on-demand that best matches the coding conventions used in your codebase; no more long discussions with your team about the best convention to use!" Microsoft said in a post this week. "Once generated, this file will help you maintain consistency in your team’s codebase. Fixing up formatting issues is quick and easy with the Quick Action lightbulb menu (Ctrl+. or Alt+Enter) or with the new configurable Format Document (Ctrl+K, D) in Visual Studio 2017 version 15.8 Preview 3 and higher."

Developers can trigger generation of the .editorconfig file in a couple of different ways and direct what code files are enforced by placing it in the project directory structure to work with files "below" it. So it can be applied to the whole project or subfolders if developers want to apply different coding conventions to different projects.

Coders also have leeway in how seriously style violations are enforced. The default is "message" severity, though that can be upgraded to "warning" or "error."

While the tool works only with C# code now, support for more programming languages is on tap. Mark Wilson-Thomas, senior program manager, Visual Studio IDE Team, said as that support and more scenarios are added to the tool, Microsoft will announce a limited preview of IntelliCode.

As of this writing, the preview extension has been installed more than 52,000 times, earning a 4.7 (0-5 scale) from 20 developers who provided reviews.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube