Open
Description
In 1.4.0 we introduced completions for all local identifiers in the project. These completions automatically insert missing imports. It turns out that we don't verify whether the imports are actually missing, leading to some problems:
- Redundant imports, if the import already exists
- Conflicting import, if it's a redundant import that conflicts with something that already exists
- Circular imports, if the completed identifier is defined in the module being edited
All the above are painful, but 2 and 3 are specially annoying.
The solution for this would be:
- for 1, to perform an isNeeded check in the command that inserts the new import.
- for 3, to verify that the inserted module and the current module are different
- 2 is a bug in the ordering of the completion suggestions. For example the user could legitimally want to use
ByteString
fromData.ByteString.Lazy
even ifData.ByteString
is already imported. The bug is in suggesting the non-imported completion before the imported one.