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

  • GitHub Copilot for Azure Gets Preview Glitches

    This reporter, recently accepted to preview GitHub Copilot for Azure, has thus far found the tool to be, well, glitchy.

  • New .NET 9 Templates for Blazor Hybrid, .NET MAUI

    Microsoft's fifth preview of .NET 9 nods at AI development while also introducing new templates for some of the more popular project types, including Blazor Hybrid and .NET MAUI.

  • What's Next for ASP.NET Core and Blazor

    Since its inception as an intriguing experiment in leveraging WebAssembly to enable dynamic web development with C#, Blazor has evolved into a mature, fully featured framework. Integral to the ASP.NET Core ecosystem, Blazor offers developers a unique combination of server-side rendering and rich client-side interactivity.

  • Nearest Centroid Classification for Numeric Data Using C#

    Here's a complete end-to-end demo of what Dr. James McCaffrey of Microsoft Research says is arguably the simplest possible classification technique.

  • .NET MAUI in VS Code Goes GA

    Visual Studio Code's .NET MAUI workload, which evolves the former Xamarin.Forms mobile-centric framework by adding support for creating desktop applications, has reached general availability.

Subscribe on YouTube