Skip to content

search as you type imports #1902

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

Open
matejthetree opened this issue Mar 9, 2018 · 5 comments
Open

search as you type imports #1902

matejthetree opened this issue Mar 9, 2018 · 5 comments
Milestone

Comments

@matejthetree
Copy link

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.

@zoechi
Copy link

zoechi commented Mar 9, 2018

dup of dart-lang/sdk#25820

@pq
Copy link
Contributor

pq commented Mar 9, 2018

/cc @scheglov

@pq pq added this to the Backlog milestone Mar 9, 2018
@pq
Copy link
Contributor

pq commented May 24, 2018

@scheglov : does DAS have the hooks for this?

@scheglov
Copy link
Contributor

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.

@pq
Copy link
Contributor

pq commented May 24, 2018

Thanks for all the context @scheglov! Looks like this one will have to wait for some DAS plumbing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants