Skip to content

Autocomplete for overriding methods does not show if the method has non-imported types #4116

@osaxma

Description

@osaxma

Describe the bug

Assume we've this on a.dart file:

import 'dart:async';

abstract class Base {
  FutureOr<String> method() => '';
}

And on b.dart file we are trying to overide Base.method:

import 'a.dart';

class BaseImpl extends Base {
  
  // <~~ typing the word `method` here does not show autocomplete suggestions 

} 

i.e.:

Screen Shot 2022-08-23 at 11 19 03 PM

Though, if we import dart:async in b.dart, the autocomplete for override works.

Screen Shot 2022-08-23 at 11 19 18 PM

The same issue would occur if the non-imported type is an argument of the method instead of a return type.

Expected Behavior:

I would expect the autocomplete to show up, and once it's selected, it'll import all the necessary libraries (i.e. dart:async in this case)


Please complete the following information:

  • VS Code version: Version: 1.70.1
  • Dart extension version: v3.46.1
  • Dart/Flutter SDK version: Dart SDK version: 2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "macos_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions