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

Multiline import statements #43

Open
nvi9 opened this issue Jan 6, 2021 · 2 comments
Open

Multiline import statements #43

nvi9 opened this issue Jan 6, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@nvi9
Copy link

nvi9 commented Jan 6, 2021

Describe the bug
When an import statement being splitted in multiple lines (eg. because exceeding the default 80 characters with show or hide on any long import) the tool moves these lines to the end of the import list. It seems these import statements are not recognized, so they are put in afterImportLines here.

To Reproduce

  1. For example add flutter_local_notifications as a dependency, as this package will result quite long import lines.

  2. Import the package and let's say you want to hide a type (eg. because you have one with the same name in your current file already).

    import 'package:flutter_local_notifications/flutter_local_notifications.dart' hide PendingNotificationRequest;
  3. After saving (if you have autoformat on) or formatting (eg. with dart format . or flutter format .) this line is splitted to two, since its length is 110 characters (default and recommended max line length is 80 chars).

    import 'package:flutter_local_notifications/flutter_local_notifications.dart'
        hide PendingNotificationRequest;
  4. When running the import_sorter command, this import line "pair" is moved after all other imports.

Expected behavior
Move multiline imports to the section they belong to.

Meta Information:

  • Dart Version: 2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "windows_x64"
  • import_sorter Version: 4.4.1
  • Is it a Flutter project? Yes
  • What version of Flutter are you using (if flutter project): 1.22.5 (channel stable)
@nvi9 nvi9 added the bug Something isn't working label Jan 6, 2021
@github-actions
Copy link

github-actions bot commented Jan 6, 2021

👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible.

@gleich
Copy link
Member

gleich commented Dec 7, 2021

See #63

@gleich gleich closed this as completed Dec 7, 2021
@gleich gleich reopened this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants