Autocomplete of names not in scope gets confused by re-exported libraries

Being able to automatically import symbols that aren’t yet in scope is great but I’m having trouble with it being a bit too aggressive.

On a bleeding edge Dart SDK from Friday:
Repro steps:

import 'package:flutter/material.dart';

Now autocompleting a name from package:flutter/widgets.dart leads to problems as the symbols are available both through widgets.dart and the material.dart library that reexports them. You see duplicate entries for the same class in the autocomplete lists and the autocomplete functionality sometimes defaults to trying to make the import with a autogen prefix which causes me to have to undo and delete the prefix every time it gets suggested.

Example showing a prefix being generated without me doing anything to try to accept it even though the name is already in scope. In general it would be nice if some acceptance action was required to ever trigger importing with a prefix.

FYI @scheglov

Author: Fantashit

2 thoughts on “Autocomplete of names not in scope gets confused by re-exported libraries

  1. It seems that this issue is a mix of two separate issues.

    1. Filtering duplicates of elements already available via existing imports. This is implemented with existingImports notification in DAS. @lambdabaa is adding support in IntelliJ.
    2. Unnecessary import prefix. This was fixed.

Comments are closed.