Skip to content

Missing import suggestions #30295

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
JFixby opened this issue Jul 31, 2017 · 4 comments
Open

Missing import suggestions #30295

JFixby opened this issue Jul 31, 2017 · 4 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-server Issues related to some aspect of the analysis server P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@JFixby
Copy link

JFixby commented Jul 31, 2017

Reproduction steps:

Example project: https://github.com/JFixby/DartImportsExample

class A located in the lib/folderA/class_a_file.dart
content:

class A {
  static String fieldF = "";
}

class C located in the lib/class_c_depends_on_a.dart depends on the A
content:

class C {
  C() {
    // editing this line
  }
}

What was done

print A. in the constructor of the class C

What is expected

to see a list of suggested imports with proposal to import lib/folderA/class_a_file.dart

What is actually happening

no relevant suggestions

image

Setup

IDEA version: community 2017.2
Dart plugin: 172.3317.48

@bwilkerson bwilkerson added the area-intellij Tracking issues for the Dart IntelliJ plugin. label Jul 31, 2017
@devoncarew devoncarew added the type-enhancement A request for a change that isn't a bug label Jul 31, 2017
@alexander-doroshko
Copy link

alexander-doroshko commented Aug 15, 2017

@JFixby, your screenshot shows code completion popup. Code completion suggests items that may appear at the caret position. Import statement can't appear after A., that's why you do not see it.

You'll get a suggestion to add import if you invoke quick fix on red code (Alt+Enter):
image

It would be great if code completion helped to write class names from files that are not imported yet and auto-imserted required import statements. Since code completion is powered by the Analysis Server this issue is tracked at SDK end, see #25820 and #21931.

As for this issue, I think it can be closed.

@JFixby
Copy link
Author

JFixby commented Aug 15, 2017

I'll use Eclipse to illustrate what I mean:

Write Collections. and it shows list of suggested methods of different classes that have name Collections.
Clicking on a suggestion auto-completes statement and adds related import.

Saves a lot of time.

image

@JFixby
Copy link
Author

JFixby commented Aug 15, 2017

Please treat it as a feature request and re-open.

@alexander-doroshko
Copy link

Thanks for the example! This is pretty much similar to what is asked in #25820 and #21931. Ok, I'm reopening and moving to area-analyzer. Let @bwilkerson take another look.

@alexander-doroshko alexander-doroshko added legacy-area-analyzer Use area-devexp instead. and removed area-intellij Tracking issues for the Dart IntelliJ plugin. labels Aug 15, 2017
@bwilkerson bwilkerson added the P2 A bug or feature request we're likely to work on label Aug 16, 2017
@srawlins srawlins added the devexp-server Issues related to some aspect of the analysis server label Jun 8, 2020
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-server Issues related to some aspect of the analysis server P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants