You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running "Fix All" command takes a long time (~13s) #3469
After some potential modifications (I was not working on project for some time), VSCode started taking too long time when I save dart file. These "potential modifications" may be some libs update in pubspec.yaml (after pull other teammate's changes), or maybe flutter version update.
Anyway, it either takes too long or doesn't finish at all, so I have to cancel it and only then Hot Reload updates app (I'm using physical device connected by USB).
changed the title [-]Performance issue in VSCode on dart flutter project save and no formatting on save[/-][+]Running "Fix All" command takes a long time (~13s)[/+]on Jul 12, 2021
Moreover, I investigated that it was added 2 weeks ago by other team member, while I was inactive in this project. If I remove this - file saves pretty fast. Manual formatting works as well. Is there a chance I have source folder configured wrong, so it takes too many files into account?
I also checked if this issue occurs on other project, and it does not, however the second project is significantly smaller (1/3 of current project size I guess).
Also I checked if issue occurs on other PC I use to work and it does not, so it seems to be attached strictly to this workspace on my MacBook.
Reacted by Bharathraj E, gladsonADBS and joranmulderij
Thanks - I tested this with some larger projects and also saw similar timings - such as 10 seconds for flutter_gallery/lib/studies/shrine/expanding_bottom_sheet.dart. I'm not certain what the expectations are here, the code we're is usually run across a whole project (eg. as part of dart/flutter fix) so it might not really be optimised for single-file use (or I may not be using it optimally).
For now I would recommend not running this command on-save and instead manually invoking it with the Fix All command in VS Code.
This is fixed by dart-lang/sdk@de918b2. It now reuses the existing analysis contexts which should make things fast (whereas before the files were being resolved in a new context - which was fine for the command line tool which wouldn't have any existing contexts, but wasteful here).
The fix is in the SDK, so it'll show up in a future Dart/Flutter SDK (if you're using Flutter master, I would expect it'd show up within a few days).
@ViniciusSossela as noted above, this involved changes in the SDK so will only show up when using an SDK that includes those changes. This does not currently include the stable channels of Dart/Flutter, though it is available on some of the other channels. It'll show up in stable after a future SDK release. Hope this makes sense!
Reacted by Vinicius Sossella and Ricardo Emerson de Freitas Jardim
@walles this issue is about the performance of the command, not whether it appears. If you're not seeing the command, please file a new issue and include your versions of VS Code, the Dart extension and the Dart/Flutter SDK shown in the bottom-right status bar. Thanks!
@naveenkumarp369 this issue was specific to VS Code / the LSP server. Since your issue is happening from the terminal it will be something different.
Please file an issue at https://github.com/dart-lang/sdk/issues and include information about your project that might help understand the issue (for example how large / how many files is it, how many issues are reported by dart/flutter analyze that could be being fixed, and which version of the SDKs you are using). Thanks!
Activity
DanTup commentedon Jul 12, 2021
It's not the problem, but do you have this enabled in your settings? (if not, I wouldn't expect it to run Fix All on-save).
Can you also confirm if this only happens in a specific project, or all of them?
I can see in the logs that the call to
fixAlltook 13 seconds which does seem quite slow:If you can share an exact project/file that it takes this long on and I can reproduce it here, I can look at why it's taking so long. Thanks!
[-]Performance issue in VSCode on dart flutter project save and no formatting on save[/-][+]Running "Fix All" command takes a long time (~13s)[/+]stas-lesiuk commentedon Jul 14, 2021
Hi, I just checked my
.vscode/settings.jsonand it has just 3 lines, which are:Moreover, I investigated that it was added 2 weeks ago by other team member, while I was inactive in this project. If I remove this - file saves pretty fast. Manual formatting works as well. Is there a chance I have source folder configured wrong, so it takes too many files into account?
I also checked if this issue occurs on other project, and it does not, however the second project is significantly smaller (1/3 of current project size I guess).
Also I checked if issue occurs on other PC I use to work and it does not, so it seems to be attached strictly to this workspace on my MacBook.
DanTup commentedon Jul 14, 2021
Thanks - I tested this with some larger projects and also saw similar timings - such as 10 seconds for
flutter_gallery/lib/studies/shrine/expanding_bottom_sheet.dart. I'm not certain what the expectations are here, the code we're is usually run across a whole project (eg. as part of dart/flutter fix) so it might not really be optimised for single-file use (or I may not be using it optimally).For now I would recommend not running this command on-save and instead manually invoking it with the Fix All command in VS Code.
[analysis_server] Use existing context when computing edits for an LS…
DanTup commentedon Jul 14, 2021
This is fixed by dart-lang/sdk@de918b2. It now reuses the existing analysis contexts which should make things fast (whereas before the files were being resolved in a new context - which was fine for the command line tool which wouldn't have any existing contexts, but wasteful here).
The fix is in the SDK, so it'll show up in a future Dart/Flutter SDK (if you're using Flutter master, I would expect it'd show up within a few days).
ViniciusSossela commentedon Aug 3, 2021
@DanTup I am trying to launch the
Fix Allcommand, but it doesn't show on the command palette. Am I missing something?DanTup commentedon Aug 3, 2021
@ViniciusSossela as noted above, this involved changes in the SDK so will only show up when using an SDK that includes those changes. This does not currently include the stable channels of Dart/Flutter, though it is available on some of the other channels. It'll show up in stable after a future SDK release. Hope this makes sense!
walles commentedon Jun 11, 2022
@DanTup do you know when this could happen? I still don't see any "Fix All" on my command palette...
DanTup commentedon Jun 11, 2022
@walles this issue is about the performance of the command, not whether it appears. If you're not seeing the command, please file a new issue and include your versions of VS Code, the Dart extension and the Dart/Flutter SDK shown in the bottom-right status bar. Thanks!
naveenkumarp369 commentedon Aug 4, 2023
PS D:\app-repo-store\ODAPP_July2023_fixImageCapture\AICL-ODCollection-App> dart fix --apply
Computing fixes in aicl-odcollection-app...
I waited for more than an hour , its stuck in same . What can i do ?
DanTup commentedon Aug 7, 2023
@naveenkumarp369 this issue was specific to VS Code / the LSP server. Since your issue is happening from the terminal it will be something different.
Please file an issue at https://github.com/dart-lang/sdk/issues and include information about your project that might help understand the issue (for example how large / how many files is it, how many issues are reported by
dart/flutter analyzethat could be being fixed, and which version of the SDKs you are using). Thanks!