flutter-intellij: Code Completion not working properly anymore after upgrading to 2021.3

Hi,

I am not quite sure whether this is a Flutter or an Android Studio issue. Hopefully somebody can help me here, when it is a

I upgraded my Android Studio from 4.x to 2021.3 at the same time I upgraded from Flutter 2.x to 3.3.9) a few weeks ago. From that point my auto completion has not been working properly anymore.

  • [CTRL] + [SPACE] still opens and display a suggestion list containing
    • Flutter internal classes (I assume this is because of already imported flutter/material.dart package)
    • Classes from current file
    • Classes from explicitly imported files

Everything, which is not already explicitly imported into the current working file is ignored. So I am not able to use automatical imports, I need to find the correct file path by myself and have to include it manually before further writing.

What works:

  • I observed, an older version of my project works fine on the same setting. So I am wondering, whether a project may becomes too huge? (currently > 1000 files in the lib directory and > 40 external libs in pubspec.yaml) But why did the setup before the upgrade worked properly?
  • When I open the project on a pure IntelliJ (with installed Flutter/Dart plugins, of course), the code completion works as well

What I tried:

  • Cleared/Removed every possible cache directory I could find (Flutter, Pub, Android Studio, Gradle, …)
  • Completely upgraded, removed and reinstalled the entire setup
  • No PowerSafe mode
  • My mates have no problems with the project having similar setups

Flutter doctor:

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19045.2251], locale de-DE)
    • Flutter version 3.3.9 on channel stable at E:\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (3 weeks ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at E:\Android\sdk                                                                      
    • Platform android-33, build-tools 33.0.1                                                            
    • ANDROID_HOME = E:\Android\sdk                                                                      
    • Java binary at: E:\Android\Android Studio\jre\bin\java                                             
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)                        
    • All Android licenses accepted.                                                                     

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2021.3)
    • Android Studio at E:\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 13 (API 33) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.19045.2251]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 107.0.5304.107
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 103.0.1264.44

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

(AS Dart Plugin: 213.7433, Flutter Plugin: 71.1.3)

If relevant: https://github.com/S-Man42/GCWizard/tree/master

Thanks in advance, Mark

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

My status so far:

On a test query - asking for completion after the m in an added line print(Cryptm); in the main method in lib/main.dart - I experience the same as you.

I’ve modified the analyzer to have a much larger timeout and then I start getting the wanted results. On subsequent calls (it has to do some stuff the first time) it takes ~400 ms. Most of this time is spent sending log data to the plugin that seemingly does not use it. I’ve created https://github.com/flutter/flutter-intellij/issues/6574 to hopefully get that disabled. For my testing, disabling the flutter intellij plugin so that I only have the dart intellij plugin enabled (which doesn’t ask for the same log data) the query is now answered in ~150 ms instead.

The default timeout is 100 ms so this is still not fast enough, though I would argue for increasing the timeout. I’ve created https://github.com/dart-lang/sdk/issues/51065 for that.

I have another thread to pull to see if I can make it faster and we’ll see what happens.

I have another thread to pull to see if I can make it faster and we’ll see what happens.

I completely forgot to make an update on this. I landed https://github.com/dart-lang/sdk/commit/e4f08827095c1352ae35206a6a253b034a9b4b27 which at least on some queries helps quite a bit (taking the query I was primarily testing on from an average of ~155 ms to an average of ~65 ms on my machine — all tested with the dart plugin, not the flutter plugin, but I suppose it should be the same with the new version of the flutter plugin).

I don’t know when there will be a Dart release with it included though.

Thanks for checking. We have a new plugin ready for release Wed. (I’m doing som final testing today.) That should help with completions, but @jensjoha has already made some improvements to the analyzer that help even more. However, I don’t know when that will be available in Flutter. After version 72 is available, could you update and check again?

I tested it. The autocompletion never appears, not even after 10 tries atm.

I gave it several tries, don’t know if it were 6, but surely several times. I can try next week.

I have a similar issue with compiler bugs: I use it as work around for the missing auto complete. To get the import, I use the “resolve issue” feature. It usually takes 3 or 4 tries until the “solve by import package…” point appears. I don’t know whether both issues have relate but maybe this information helps before next week