Skip to content

Hints completes code in the wrong places #8615

@feinstein

Description

@feinstein

Try to create this code:

  StreamSubscription<int>? subscription;
  subscription?.cancel();

You will see this hint:

Image

Missing an 'await' for the 'Future' computed by this expression.

So you hit Option+Enter (MacOS) and you get this:

Image

Accept it and it will generate this:

Image

Which is completely wrong, the await is being placed at the wrong place.

This happens for multiple other "smart completes" (sorry I don't know the name of these).


Another example:

class TestClass {
  List<int> list = [];
}

// ....
final test = TestClass();
test.list.for // hit Tab here to accept the "for" shortcut
Image

This is what it generates:

Image

Which we can see it's placing the for at the wrong place. It looks like it can't understand that the list belongs to an object, and can't be used by itself.

@alexander-doroshko, is this something at your end?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions