dart-atom / dart

A Dart plugin for Atom.
http://dart-atom.github.io/dart/
BSD 3-Clause "New" or "Revised" License
154 stars 44 forks source link

Can we suggest an import for a new name, in a Quick Fix? #730

Open sethladd opened 8 years ago

sethladd commented 8 years ago

I tried Control-1 on a name that wasn't imported, but is available from a library provided by a package.

I saw these options:

screen shot 2016-01-26 at 4 27 38 pm

Could we add an option, like "Import package:flutter/widget.dart" ?

Atom 1.4.1, dartlang 0.5.3, SDK 1.14.0-dev.7.2 running on macos.

devoncarew commented 8 years ago

@scheglov, is something like this already handled by the analysis server - and something I need to wire up - or would this be a feature request?

scheglov commented 8 years ago

If the library package:flutter/widget.dart is know to the analysis context, i.e. it is analyzer because any other library (implicit or explicit) imports it, then the Analysis Server will produce the import quick fix. If it not used, and exists only as an imported package in pubspec.yaml - we know nothing about it, and don't produce the quick fix.

sethladd commented 8 years ago

Hi @scheglov it comes from a package in my pubspec.yaml. The analyzer doesn't scan all dependencies to make them potentially available?

scheglov commented 8 years ago

No, analyzer does not look at code which is not in the project and is not referenced from a project library.

lukechurch commented 8 years ago

@sethladd I had a prototype a while back that would use a service to index the places you might have got this from. So you could write a type and it would offer the various packages that export it. It this is important enough, and there is agreement to from the other folks, I can fairly easily bring it back to life and productionise...

sethladd commented 8 years ago

The baby step here might be "look in all packages referenced by .packages/pubspec.lock". Don't wait for the library to be manually imported (even transitively). I've already done the work to run pub get... the library is sitting right there to be imported :)

cc @kevmoo FYI