Open matejthetree opened 6 years ago
dup of dart-lang/sdk#25820
/cc @scheglov
@scheglov : does DAS have the hooks for this?
No, at least not yet.
There are two parts that should be implements.
SuggestionCompletion
has importUri
, but it is not what we need.
We need a SourceChange
that describes where in the library a new import should be inserted, if needed.
And DAS should be updated to suggest all public top-level declarations from all libraries (imported in the current library, or not), from all packages. Hm... That's a lot of data. And most of the libraries don't changes their export namespace. Actually when the user types in file, it is usually in a method body, or in a class body, so top-level declarations don't change at all, not even for a single library. It's like 90%
chance. The next most probably case, let's say 8%
is when you actually change top-level declarations for a single library.
We could try to implement it with the current API, but it would be a huge waste. Ideally we should cache per-library completion suggestions and update them as needed.
Thanks for all the context @scheglov! Looks like this one will have to wait for some DAS plumbing.
At the moment I have to type StatefulWidget and press alt enter so that intellij offers me to import the package.
Is it possible that I type new SW and that I get options to import this?
To reproduce, create new class in a new file and try to extend the noted class.