Autocomplete doesn't work properly with enums when using named imports
Describe the bug
When using named imports, auto completing enum doesn't show the value but prompt to insert a switch condition as shown below:
To Reproduce
import 'dart:ui' as ui;
void main() {
final x = ui.BlendMod // <~~ auto complete here
}
Expected behavior
I expect the enum values to be shown
Please complete the following information: Extension version: v3.74.0 VS Code version: 1.83.1 Flutter 3.13.6 • channel stable • Dart 3.1.3 • DevTools 2.25.0
Seems like there are two unrelated issues here:
- switch expression showing up in the wrong place
- Enum member not showing up
A single-file repro that doesn't require Flutter:
import '' as e; // import self as e
enum MyEnum {
one,
two,
}
void main() {
final x = e.MyEnum.^
}
One of these is easier to fix than the other, so splitting the switch expression part out to https://github.com/Dart-Code/Dart-Code/issues/4795.
Also see https://stackoverflow.com/q/77873381/ which describes a similar problem for static methods when using named imports.
It appears that this has been resolved now: