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 for Converge360.

comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube