-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a custom fix all provider for SA1133 #1893
Conversation
Current coverage is
|
var indentationSteps = IndentationHelper.GetIndentationSteps(indentationOptions, attributeList); | ||
var indentationTrivia = IndentationHelper.GenerateWhitespaceTrivia(indentationOptions, indentationSteps); | ||
newRoot = newRoot.ReplaceNode(newRoot.GetCurrentNode(attributeList), GetNewAttributeList(attributeList, indentationTrivia)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Wouldn't it be more efficient to build a dictionary of replacements and then do a single ReplaceNodes
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReplaceNodes
as far as I know does not support replacing one node with a set of new nodes. This is why I had to use ReplaceNode
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I forgot about that. I just had a look at the SyntaxRewriter
as well and it also suffers from the same problem.
It could still be done using the parent node of the AttributeListSyntax
, but that would be a large amount of work and I'm not sure if the performance gain is significant enough for that.
👍 Looks good to me |
👍 |
Implement a custom fix all provider for SA1133
Fixes #1879.