Open hamarb123 opened 6 months ago
@CyrusNajmabadi I'm not able to find a reference to the pull request(s) where #29482 or #65247 were fixed. Can you help with that?
Here's the line of code that skips comment formatting if the current indentation is considered "correct": https://github.com/dotnet/roslyn/blob/21499087d8dbb2cacd603c98531d37a298131ae1/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Engine/Trivia/TriviaDataFactory.CodeShapeAnalyzer.cs#L197
Here's the line of code preventing the previous line of code from working when UseTabs
is true:
https://github.com/dotnet/roslyn/blob/21499087d8dbb2cacd603c98531d37a298131ae1/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Engine/Trivia/TriviaDataFactory.ComplexTrivia.cs#L78-L80
The above code is 10 years old, so it doesn't explain why #29482 was filed as a bug, or what ended up fixing that.
Version Used: VS 17.9.5, roslyn 4.9.0-3.24121.1 (a98c90d5); AND VS 17.10.0 Preview 3.0, roslyn 4.10.0-3.24202.15 (cbca41ca).
Steps to Reproduce:
(make sure it uses tabs, and not spaces)
Diagnostic Id:
IDE0055 fix formatting. (move
//b,
to align with//a
)Expected Behavior:
No diagnostic.
Actual Behavior:
Error.
Additional information:
See https://github.com/dotnet/roslyn/issues/29482 for the feature request
Also, if you replace the tabs with spaces, and update the .editorconfig appropriately, you get no error (as per the original feature request) - it only occurs with tabs.
This is a blocker for me with enabling proper formatting rules in my projects.
/cc @CyrusNajmabadi who was discussing this with me on discord