Skip to content
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

Imports: implement contiguousGroups logic #2719

Merged
merged 2 commits into from
Sep 3, 2021
Merged

Conversation

kitbellew
Copy link
Collaborator

Fixes #2718.

@kitbellew kitbellew requested a review from tgodzik September 1, 2021 16:18
@kitbellew kitbellew force-pushed the 2718 branch 2 times, most recently from f5d0d92 to 88b5711 Compare September 2, 2021 18:54
@kitbellew
Copy link
Collaborator Author

@tgodzik thoughts on this?

group at the end). Regular expressions are applied to the entire parent domain
of the import statement, up to and including the final dot.
- `rewrite.imports.contiguousGroups` (since v3.0.2):
- if `no` (default), grouping will happen on all imports within the same
Copy link
Contributor

Choose a reason for hiding this comment

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

I would honestly make it a default and not even add a setting for this. There is a high chance that val or something else between imports is there on purpose.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i can make it default but in our codebase, we prefer to take imports spread out around the file and put them in one place. users can define their vals and then import everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ach, ok, it makes sense. But I think the default should be to not touch it, that's the safer side.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed the default

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome thanks!

@kitbellew kitbellew merged commit 1be9565 into scalameta:master Sep 3, 2021
@kitbellew kitbellew deleted the 2718 branch September 3, 2021 19:53
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.

Sort imports with groups can reorder program execution
2 participants