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

Not working with import sorter package #30

Open
ianjaspersantos opened this issue Nov 19, 2020 · 1 comment
Open

Not working with import sorter package #30

ianjaspersantos opened this issue Nov 19, 2020 · 1 comment

Comments

@ianjaspersantos
Copy link

The extension do not work when working with flutter package "import sorter". The problem is occuring when the dart import extension trying to sort lines with comments in between the imported files..

@luanpotter
Copy link
Member

If you have comments within your imports it gets really hard for this to automatically sort everything right? Dare I say impossible as there can multiple desired outcomes.

Let's say you have:

// group 1
import 'local/file.dart';
import 'package:foo/bar.dart';


// group 2
import 'package:my_package/local/file2.dart';
import 'dart:foo';

The expected result (removing the comments would be):

import 'dart:foo';

import 'package:foo/bar.dart';

import 'local/file.dart';
import 'local/file2.dart';

Where should each comment be put on the new structure? Since every import can change place, I don't see how we can correctly place comments back. If you are using this plugin you are relying on automatically defining the ordering of imports; in that case I think it doesn't make sense to have any comments in your import section. Comments are for humans. This plugin treats your import section as a "generated" part of your code.

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

No branches or pull requests

2 participants