visual-studiovisual-studio-2022editorconfig

Visual Studio 2022 editorconfig not applied on cleanup


I'm having a bit of trouble understanding how .editorconfig should work.

Am i understanding something wrong? shouldn't vs code cleanup refactor files based on .editorconfig rules?

moreover, if i try to open the .editorconfig file i get an empty UI in VS.

What am i missing?


Solution

  • Visual Studio's Code Cleanup feature runs a set of predefined tasks, as configured in the Code Cleanup profile. Most of these tasks correspond to specific IDE settings, some of which may be configured by .editorconfig.

    Among those is Format Document, which uses takes a lot of the .editorconfig settings into account when applying formatting all in one big operation. However, Format Document does not make refactoring changes to the existing code. It wouldn't change the overall structure of the document.

    There is a Code Fix (or lightbulb, or suggested action, or... it goes by lots of names) that will appear on the namespace block. That will provide a gesture to make the edit in that file, or across the entire project or solution (each file will be modified as applicable, as .editorconfig applies to directory hierarchies, and may not be present for all projects in the solution).

    moreover, if I try to open the .editorconfig file I get an empty UI in VS..

    This sounds like a bug and should be reported using the VS Feedback tool.