SolvedDart Code Dart code stuck on "Analyzing", making every operation take too long

After upgrading to Dart Code 3.15 and VSCode to 1.50, Dart Code gets stuck on "Analyzing", making every operation, from coded completion to saving files, take too long.

To Reproduce

  1. Use Dart Code 3.15 and VSCode 1.50
  2. Open any Flutter project
  3. Wait for the initial "Analyzing" process to finish
  4. Open any Dart file
  5. Edit the file, requesting code multiple times
  6. VSCode starts "Analyzing" after every code completion request, taking increasingly longer times every time it happens

Expected behavior
After doing initial analysis, code completion should take from a few milliseconds up to a few seconds

Versions (please complete the following information):

  • 1.50
  • 3.15.0
  • Flutter 1.22

Output from flutter doctor -v
❯ flutter doctor -v
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [versão 10.0.19041.508], locale pt-BR)
• Flutter version 1.22.0 at D:\dcvia\Desenvolvimento\Android\flutter
• Framework revision d408d302e2 (10 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\dcvia\Desenvolvimento\Android\Sdk
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = D:\dcvia\Desenvolvimento\Android\Sdk
• Java binary at: C:\Users\dcvia\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Android Studio (version 4.0)
• Android Studio at C:\Users\dcvia\android-studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.50.0)
• VS Code at C:\Users\dcvia\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.15.0

[√] Connected device (1 available)
• SM G950F (mobile) • ce11182b72a0ba3a02 • android-arm64 • Android 9 (API 28)

22 Answers

✔️Accepted Answer

I battled with this for a few hours. In case anyone else is battling with this, in the end I tracked the issue down to a half written line of code:

Future<List<>>

Other Answers:

Thanks for the logs - I can definitely see a lot of slowness for some requests, though it's not entirely clear why (the log also doesn't seem to contain any analysis status notifications where I'd expect to see the appear/disappear).

Some things to try:

  1. Enable the dart.previewLsp setting. This moves more of the work into the server and has some reasonable performance gains (especially when it comes to code completion). LSP will become the default in the near future.

  2. If you were running debug sessions when seeing these issues, try this beta build (v3.15.1 may be released later today, so if you've already been upgraded to v3.15.1 by the time you read this, no need to install the beta). There was a severe performance issue in v3.15.0 that would consume vast amounts of CPU when printing large strings (or large numbers of) while your app was running.

  3. Run code --status when the CPU is high / stuck analyzing and provide the output here.

If anyone can reproduce this reliably on a public project they can share, that may help me track down what's going on.

Thank you, enabling dart.previewLsp solved the issue for me (at least for now)

Glad to hear! I'll close this on the basis that the non-LSP version is going away over the coming releases.

does it mean that a service is created for dealing with the analysis which isn't attached to VS Code process?

This has always been the case, though the protocol that the VS Code extension uses to communicate with the Dart language server is changing slightly with this (it used to be a custom protocol designed for Dart, but LSP is a standard that many languages/editors use).

It's fairly common for languages to have their own "language servers" that run separately from the editors. This allows sharing a lot of functionality (like code completion and analysis) between editors much more easily (and LSP aims to make this even easier).

Hope this helps!

Related Issues:

19
Dart Code Dart code stuck on "Analyzing", making every operation take too long
I battled with this for a few hours In case anyone else is battling with this After upgrading to Dar...
18
Dart Code Support --flavor argument in the debugger
Ok I think maybe the existing args already supports this I just set my launch.json like this: When I...
12
Dart Code Implement refactor: Move file
The work is mostly done here but it requires a VS Code feature that is currently part of the provisi...
10
Dart Code Closing Labels feedback
@brettpappas You can actually control the colour using workbench colour cusomisations! Add this to y...
459
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
449
flutter App Store iOS submission fails: The bundle Runner.app/Frameworks/App.framework does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
418
flutter 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My gradle.build file is: flutter doctor: ...
409
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
383
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...
381
flutterfire [firebase_core_web , firebase_auth_web, cloud_firestore_web ] Plugin project :firebase_auth_web not found. Please update settings.gradle.
Hi @gsusI Please add this in flutter app -> android -> settings.gradle if you disagree please write ...
315
flutter Missing xcode dependency: Python module "six"
try python2.x -m pip install six by @humblerookie's suggest or brew reinstall python@2 pip install s...
285
flutter flutter messaging: set the notification icon
Hey guys I fought with this for the better part of a day For some strange reason there are no tutori...
281
flutter Issue with cloud_firestore - Cannot fit requested classes in a single dex file.
As a workaround you can try enabling mutlidex for Android App by following Enable multidex for apps ...
265
flutter D8: Program type already present: io.flutter.BuildConfig
@smrucv I received the same error but after flutter clean and flutter packages get everything works ...
252
provider A Product was used after being disposed. flutter: Once you have called dispose() on a Product, it can no longer be used.
Oh I see what you're doing Don't: DO: i have a ChangeNotifireProvider that such that i do pushReplac...
250
238
flutter Introduction of characters package causes crash on flutter run for preexisting Flutter applications
In my case I resolved the issue with flutter clean After e0ed12c I get this error when building: @ju...
221
flutter Making Network http error SocketException: Failed host lookup
@hoc081098 Double-check / make sure you have <uses-permission android:name=android.permission.INTERN...
216
flutter Support inlining Android/iOS views
iOS view embedding support has landed on master This is still just a preview There are multiple open...
207
flutter ✗ Android license status unknown.
Hi everyone Steps to Reproduce Please tell us what you were doing and what went wrong If you are run...
185
flutter idevice_id cannot run on catalina
When you're developing on Catalina Steps to Reproduce Run flutter doctor on macOS Catalina I get the...
181
flutter type 'List<dynamic>' is not a subtype of type 'List<String>'
The problem is your fromMap constructor is reading from a Map<String dynamic> ...
178
flutter TextField is hidden by keyboard inside of a Modal Bottom Sheet
This may not work for all situations but I have a modalBottomSheet that contains only a TextField ...
160
flutter Dismissing keyboard programatically
This is a better way as it also clears the focus: FocusScope.of(context).requestFocus(new FocusNode(...
157
flutter How to solve: Android license status unknown and also Android sdkmanager tool not found? Tried everything(as i think)
The answer is here Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1...
156
flutter MissingPluginException: No implementation found for method
@mravn-google Yeah turned out I had to quit the flutter run process and start it up again Just a ful...
156
flutter firebase_auth: ^0.8.0+1 crashes on Android
Here i put this in file: android/gradle.properties: and changed targetSdkVersion to 28 and it worked...
153
flutter Android sdkmanager tool not found (C:...\Local\Android\sdk\tools\bin\sdkmanager)
This worked for me: open Android Studio's SDK Manager go to the Android SDK tab under SDK Tools ...
149
flutter 1.22.2 - Flutter plugin not installed; this adds Flutter specific functionality.
Hey @bhanuka96 try this line of code How do I fix this android plugin error? This error is being com...
139
flutter [ios][release] GeneratedPluginRegistrant.m Module not found
I may have found the answer from this comment: #21989 (comment) Seems like by opening up the project...
137
flutter [App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator
Does rm -rf ios/Flutter/App.framework get you unstuck? SOLUTION @jmagman has written an article on h...
134
flutter Bad state: Future already completed
I had the same issue.. The problem was the same that @soaresgabriel said but I was not navigating di...
129
flutter Execution failed for task ':app:compileFlutterBuildDebug' Issue
Hi @Ramihtet your logs show a different flutter version; could you please run flutter channel stable...
124
flutter Unable to load Asset - wrong indentation in pubspec.yaml
Is your assets key underneath a flutter: key as well? https://flutter.io/assets-and-images/ ...
124
flutter Flutter 1.12.13+hotfix.5: Flutter Run: The shrinker may have failed to optimize the Java bytecode.
The plugin seems to work correctly after adding minifyEnabled true as shown above in app-level build...
121
flutter Create iOS IPA from command line
This is what I ended up using as a complete release script ready for uploading to the Play Store/App...
118
flutter FutureBuilder rebuilds unnecessarily when we long press on FAB button or appBar UI.
Hello I believe the problem here is that didUpdateWidget of the FutureBuilder state is being called ...
112
flutter LinearGradient stops/colors properties as named parameters fail
Ah nice I'm on master but also had to flutter clean and then restart VS Code and now it has gone awa...
109
flutter gradle initializing taking forever
MacOS Android Studio 3.0.1 Try to install gradle manually (https://services.gradle.org/distributions...
102
flutter invalid text selection: TextSelection with TextEditingController
Can also confirm clearing text in single textfield throws exactly same exception FocusScope.of(conte...
102
flutter Bad state: Unexpected diagnostics:
Was able to fixed After add this in pubspec.yaml the error gone Thanks #62996 and #62240 ...
99
flutter_svg Error: Type 'DiagnosticableMixin' not found
There are two ways to solve it if you are in an older version of flutter other than the last one (1....
98
flutter [cloud_firestore 0.12.6] CloudFirestorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found
I tried this • flutter clean • Clean Build Folder from Xcode • delete Podfile.lock But this didn't w...
95
bloc Close instances of dart.core.Sink.
Hi @zeucxb 👋 Thanks for opening an issue! This is a false positive in the dart linter dart-lang/lin...
95
flutter How to run on iOS simulator?
Make sure you have run sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xc...
92
flutter flutter run failed due to 'Permission denied' when replacing signature of 'Flutter.framework'
After investigating i think the root cause was the xcode_backend.sh will mark the files under Flutte...
91
flutter [firebase_crashlytics] Gradle build failed
@TheVinhLuong Had the same issue your workaround worked thanks! @livingstonex If you've followed ins...
91
flutter "Minimum supported Gradle version is 5.4.1. Current version is 4.10.2."
Ran across this problem myself If anyone comes across this from google Steps to Reproduce Not much i...