Skip to content

Improve IDE IntelliSense/autocomplete for types with static/constants #35587

Open
@gabrc52

Description

@gabrc52

Dart VM version: 2.1.0-dev.9.4.flutter-f9ebf21297 (Thu Nov 8 23:00:07 2018 +0100) on "linux_x64"

When using an IDE, when an argument of a certain type is required, classes with static getters or constants of that type could be suggested, for example:

class A {
  final bool belongsToB;
  const A({this.belongsToB});
}

class B {
  static const A staticMember = A(belongsToB: true);
}

void fnThatNeedsA({A obj}) {}

void main() {
  fnThatNeedsA(obj: );
//                 ^
}

Here, B.staticMember should be an autocomplete suggestion.

See this Flutter example:

ThemeData(
  primarySwatch: 
)

The IDE suggests MaterialColor(, but what the user probably needs is Colors., so this should be the first suggestion. (primarySwatch is of type MaterialColor and the Colors class includes many static constants of type MaterialColor).

Originally filed in Dart-Code/Dart-Code#1375

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-completionIssues with the analysis server's code completion featuretype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions