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.
"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.