Autocomplete for overriding methods does not show if the method has non-imported types
See original GitHub issueDescribe 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.:
Though, if we import dart:async
in b.dart
, the autocomplete for override works.
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”
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
java - How to make autocomplete show methods suggestions ...
Right click in your editor pane for class A , go to 'Generate...' -> 'Override Methods...'. You'll then be presented with a list...
Read more >[Intellisense TS] Poor Intellisense support when overriding ...
In the Child class, try to implement the function toOverride : no autocompletion is proposed, yet TS shows the error Non-abstract class ...
Read more >Overriding and Hiding Methods (The Java™ Tutorials ...
The overriding method has the same name, number and type of parameters, and return type as the method that it overrides. An overriding...
Read more >Override methods of a superclass | IntelliJ IDEA Documentation
The list does not include the methods that are already overridden or cannot be accessed from the current subclass. Select methods to override....
Read more >Code Assistance in the NetBeans IDE Java Editor
If there is no matching pair, then the single element is ... For example, type IE , press Ctrl + Space , and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/dart-lang/sdk/commit/1d64cba68e32ed9ef6b433287a53a36da446a005 addresses the items not showing up in completion, and https://github.com/dart-lang/sdk/commit/699b42c8e3ecfe96d1247241b3c9a9312e65e8bb adds support for bringing in potentially multiple)
import
s so the code is valid.These are SDK changes, so will require a future SDK release to show up. Thanks for raising this and figuring out what was triggering it - it saved me some time debugging! 😃
Prefixes etc are respected (since they don’t produce additional imports), although we still don’t consider collisions (as noted above, that’s not specific to this).