Microsoft has updated Visual Studio IntelliCode Extension to allow for coding convention inference for C#. This update will allow teams to achieve more readable and consistent code, the company explained.
“Consistency is important for code maintainability and readability; in fact, a recent Microsoft Research study in this area showed that 18 percent of pull request review comments were related to coding conventions, styles, and naming issues,” the Visual Studio team wrote in a post.
Visual Studio IntelliCode was first announced at Build 2018 earlier this year with the idea of providing developers with a AI-assisted development solution. The extension was developed to augment workflows with machine-learning capabilities.
Now, the IntelliCode extension will generate an .editorconfig file, which matches the coding conventions already used in codebases. According to the company, this will prevent teams from having to have long discussions about what is the best convention to use and help them maintain consistency in the codebase.
Once the .editorconfig file is created, it will display coding convention violations in the error list as Messages. The file can also be altered if you want a different level of enforcement from Messages, such as a warning or error.
The company suggests developers fix code to conform to the new coding conventions using either the Quick Actions lightbulb or using the “Format Document” command.