Skip to content

Analyzer suggests auto-complete items that are not useful #35863

Closed
@matanlurey

Description

@matanlurey

My file looks approximately like this:

import 'package:angular/angular.dart';
import 'package:swlegion/catalog.dart';
import 'package:swlegion/holodeck.dart';

class Simulator {
  static final _defendingWhiteSurgeTroopers = Defender.multipleUnits(
    [
      Units.$1dot4FDLaserCannonTeam,
      Units.$74ZSpeederBikes,
    ],
    const DefensePool(
      dice: Dice
      // ^^^^^^^
    ),
  );

I wanted a suggestion of package:swlegion/holodeck.dart, which includes a DefenseDice class.

I hit CTRL-SPACE, and got:

screen shot 2019-02-05 at 12 07 42 pm

A few comments/requests:

  • Can analyzer only suggest types that are valid, especially since Dart 2?

I was assigning to DefensePool.dice, which reads:

  /// What type of dice the defending units are using.
  final DefenseDice dice;

... so I think it would be ideal to only suggest types that are valid assignments to DefenseDice.

  • Can analyzer do full-string matches instead of partial?

I typed dice, assuming that it would auto-complete to DefenseDice but instead got:

  • Directive
  • Uri.directory(...)

... etc. Maybe this makes sense up to say, 2 characters, but clearly by typing dice I did not intend to write Uri.directory. In fact, DefenseDice does not show up at all in the list no matter what I type and try to complete, because it is not imported. But that's unfortunate, because it is one of my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondevexp-completionIssues with the analysis server's code completion featurelegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions