Skip to content

Support code-fix-all for importFixes #25137

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

Merged
4 commits merged into from
Jul 3, 2018
Merged

Support code-fix-all for importFixes #25137

4 commits merged into from
Jul 3, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jun 21, 2018

At long last, fixes #20315

This was harder than the others because importFixes was written as a tree of function calls with CodeFixActions being created at the bottom of that tree, while in the middle of determining what fixes to do. That's a problem because for code-fix-all we don't want to get a CodeFixAction, we want information about one of many imports that we're adding. (We can't just combine the text changes independently, or else we'd add 5 import statements instead of an import with 5 imported names.)

So, this PR refactors it to return a ImportFix, which can be converted into a CodeFixAction, or can be added to a collection of new imports that are then added as a group.

@ghost ghost force-pushed the importFixAll branch from 92ca3a9 to ef7a8ed Compare June 21, 2018 21:22
@ghost ghost requested a review from amcasey June 21, 2018 21:22
@@ -4418,5 +4418,9 @@
"Remove braces from arrow function": {
"category": "Message",
"code": 95060
},
"Fix all missing imports": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about Add all missing imports instead.

@ghost
Copy link
Author

ghost commented Jul 3, 2018

@mhegazy @amcasey Please re-review

@ghost ghost merged commit 064ecd4 into master Jul 3, 2018
@ghost ghost deleted the importFixAll branch July 3, 2018 22:19
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix all in file for import fix
1 participant