sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Analyzer completion doesn't always suggest top-level methods in imported library

Open jensjoha opened this issue 1 year ago • 0 comments

Say I have these 2 files:

main.dart:

import "lib.dart";

void main() {
  print(calculate());
}

and lib.dart:

int calculate() {
  return 6 * 7;
}

int calculateSomethingElse() {
  return 7 * 7;
}

I then in main want to calculate something else, so I ask for completions at the ^:

import "lib.dart";

void main() {
  print(calculate^());
}

I'm told "No suggestions". I remember it's called "calculateSomething" (and then some more) so I start typing

import "lib.dart";

void main() {
  print(calculateSomething^());
}

I'm told "No suggestions".

Only if I remove the parenthesis (i.e. makes it not a call) does it suggest calculateSomethingElse.

jensjoha avatar Feb 12 '24 11:02 jensjoha