Description
The problem we currently face is that when a tool needs to add an import for an element defined in a private library we have no way to add an import for anything other than the defining (private) library, even if that element is also exported by a public library.
The need is to be able to take an arbitrary element from an internal library and efficiently determine which public libraries, if any, make that element available. Individual tools could then decide how to handle the cases where there are zero, one, or many such libraries.
We minimally need this for code completion and quick fixes / quick assists / code actions. If we're going to support it for quick fixes we should implement this in such a way that plugins can also use this API.
The dartdoc implementation currently has the notion of a 'canonical' library. We'd like to unify these two pieces of implementation into a common set of APIs, though the concept of choosing one of the potentially many public libraries to be the canonical library might only be useful to dartdoc.
The question, then, is what design we ought to use for this piece of support. The purpose of this issue is to discuss whether there are other requirements and what that design might look like.