-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Dart fails to provide correct code completion on "obvious" cases in the latest versions of Dart on the master branch (3.9.2 is unaffected), multiple tries are required for the correct completions to be returned.
I've first reported the issue on IntelliJ's bug tracker but it was determined that this is a regression from the Dart SDK.
Here's the (modified) initial bug report:
Steps to reproduce
- Create a new Dart project with an empty main and import
dart:async
(Flutter not required) ; - Write the following in the main function:
Future.value().then
; - Try to open the parentheses to open the code completion box (or press Ctrl+Space if it doesn't) for
(value) =>
.
Expected result (correct result):
(value) =>
and (value) {}
are the first available options.
Actual result (faulty result):
Seemingly random objects are suggested. To see the "correct" options, you need to press a few times Ctrl+Space.
Environment
- Dart 3.10.0-181.0.dev (dev) (Mon Sep 8 05:09:33 2025 -0700) on "linux_x64"
- on linux / Linux 6.16.5-200.fc42.x86_64 SMP PREEMPT_DYNAMIC Thu Sep 4 16:37:21 UTC 2025
- locale is fr_FR.UTF-8
Additional information
Video showing the issue (each time the suggestions change, I have pressed Ctrl+Space)
2025-09-06.16-31-19.mp4
And I'm including here the problematic request sent to the analysis server (by Alexander Doroshko) :
{"id":"50","method":"completion.getSuggestions2","params":{"file":"file:///Users/alexander.doroshko/dart_projects/DartSample2/example/web/foo.dart","offset":53,"maxResults":100,"completionCaseMatchingMode":"FIRST_CHAR","completionMode":"BASIC","invocationCount":1},"clientRequestTime":1757498553723}