codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.9k stars 358 forks source link

Codemaid Cleanup causing indentation changes #958

Closed Axemagus closed 1 year ago

Axemagus commented 1 year ago

Environment

Description

Codemaid Cleanup seems to cause indentation changes

Steps to recreate

  1. Configure VS to use 2 spaces, no tabs, and disable adaptive formatting
  2. Configure Codemaid using attached config
  3. Create some sort of C# based project and open a .cs file
  4. Trigger VS's native Format Document (indention should be 2 spaces)
  5. Trigger Codemaid's Cleanup Active Document (indentation is now 4 spaces)

Current behavior

I have VS set to use a tab size of 2 spaces, with Adaptive Formatting disabled. If I run Visual Studio's native Format Document, the spacing is maintained. However if I use Codemaid's Cleanup Active Document, the indentation is changed to 4 spaces. This happens regardless of whether I use the menu entries or shortcut keys.

This occurs whether the Cleaning -> Visual Studio -> Run format document is enabled or disabled

This seems limited to .cs files, at least for me. I tried .cshtml, .html, .xml and .js files which work as expected.

Expected behavior

Codemaid's cleanup process should respect Visual studio's configured spacing CodeMaid.config.txt

Axemagus commented 1 year ago

It appears this was an issue with Visual Studio instead of Codemaid. Updating to 17.4.2 resolved it. I suspect it might be related to https://github.com/dotnet/roslyn/pull/65382 and https://github.com/dotnet/roslyn/issues/65360 which were resolved in this release.