aziznal / dart-import-sorter

A vscode extension that groups and sorts imports for dart files (https://marketplace.visualstudio.com/items?itemName=aziznal.dart-import-sorter)
MIT License
14 stars 1 forks source link

Duplicating imports #53

Closed JCKodel closed 1 year ago

JCKodel commented 1 year ago

I have these two files:

index.dart

library solid_repositories;

import 'package:flutter/foundation.dart';

part 'i_authentication_repository.dart';

i_authentication_repository.dart

part of solid_repositories;

@immutable
abstract class IAuthenticationRepository {}

Whenever the sort is triggered, it duplicates the import 'package:flutter/foundation.dart';:

library solid_repositories;

import 'package:flutter/foundation.dart';

import 'package:flutter/foundation.dart';

part 'i_authentication_repository.dart';
aziznal commented 1 year ago

Interesting. Perhaps it has to do with the library or part statements as I haven't really added any support for those. I'll do some digging and see if I can't release a fix soon. Thanks for your feedback.

aziznal commented 1 year ago

Turns out this has nothing to do with library or anything similar. It's just some sort of edge case where there are lines before the first import statement. I've pinpointed where and how the issue is happening. shouldn't be too difficult to solve.

aziznal commented 1 year ago

@JCKodel I've released an update which should fix the duplicating issue. Let me know if it fixes the issue for you so we can close it.

JCKodel commented 1 year ago

Working fine, thanks.