-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Nested Code Fixes #144
Comments
cc @jason89521 Unfortunately we are not going to do AST manipulation, it's way too complicated and impedes our development. But I have two ideas:
|
Thanks for your input. I was thinking about the same thing, probably keeping track of how span in the original source changed through all the fixes. |
For mixed operators, I wonder how should we fix this rule. For example, |
The latter is correct in this case because of the precedence. In the AST the multiple node is a parent of the add node, and the fix is parenthesizing the child node. |
I wonder if it's possible for us to implement nested code fixes. For example, the following expression:
1 & 2 ^ 3 | 4
should be changed to
((1 & 2) ^ 3) | 4
, which involves first changing the span1 & 2
to be(1 & 2)
and then changing(1 & 2) ^ 3
to be((1 & 2) ^ 3)
.I noticed our current fixer seems to assume its fix spans are disjoint intervals. Could this be done with our current approach, i.e., manipulating source text directly rather than changing the AST?
The text was updated successfully, but these errors were encountered: