Remove code-formatting from MODiX #984
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Affects:
The (now removed) formatting logic was inherently flawed, so I decided to remove it altogether
The "short" run-down of why the current logic didn't work was the fact that it used the first line with whitespace in it, and then the last whitespace on that line. It then went on to nuke that amount of whitespace from each and every subsequent line, failing to remove whitespace if it had less than that
So in examples like this
It would pick the first whitespace from the comment, the start being before "Some" and the end being between "cool" and "comment" (11 characters of whitespace), completely ignoring that there might not have been whitespace inbetween those occurences of whitespace in the first place.
Now, if we remove the comment altogether, we end up with the next line with whitespace as the Console.WriteLine line, this has 4 spaces. This leads to the whitespace being removed entirely for both Console.WriteLine and the subsequent line.
Ergo inconsistent indentation depending on how you wrote the code.
The idea here is that we can't possibly deal with all of the edge-cases if we were to roll our own code-formatting, so we either
a) Don't deal with it at all, and present the code back to the user exactly as they wrote it
b) Introduce opinionated formatting wherever we want to, i.e. via roslyn
Fixes #975