Fix potential spacing problems when removing parentheses#453
Closed
sharwell wants to merge 3 commits intoDotNetAnalyzers:masterfrom
Closed
Fix potential spacing problems when removing parentheses#453sharwell wants to merge 3 commits intoDotNetAnalyzers:masterfrom
sharwell wants to merge 3 commits intoDotNetAnalyzers:masterfrom
Conversation
… code fix result (same behavior)
…xpression when necessary Fixes DotNetAnalyzers#449
Member
|
I have a look at this next week. I don't have time right now |
Member
Author
|
Thanks 👍 |
Member
Author
|
It turns out this situation affects other diagnostics as well. I'm changing the milestone to post-alpha 2 to give us more time to find a general solution. For example, the code fix for SA1101 takes this input: And turns it into this: |
Merged
Member
Author
|
Superseded by #646. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an alternative solution to #449. It reuses the tests originally provided in #450.
The new implementation detects a spacing error by writing the new syntax root to a string, and then parsing it to verify that the parsed version is the same as expected. If these trees are not considered equivalent (for any reason), the algorithm assumes a spacing error resulted in the combination of one or more nodes and a space is added where the opening parentheses once was.