dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.57k forks source link

Analyzer slow, broken, results in managled AST, incorrect error messages, etc... #50670

Open firephreek opened 1 year ago

firephreek commented 1 year ago

Dart Analyzer is getting worse and worse, taking longer and longer to complete and results in broken AST, mangled code, mis-colored structures, etc...Made a screen cast to see it in action. Events occur in real time.

In the video, I have two Text Widgets as placeholders that I change to MaterialButton widgets, surround with Expanded widgets. I then move to refactor the MaterialButton widgets into a new widget, MyIconButton and you can watch it all fall apart in the process. The end result is a broken AST where the syntax highlighting changes based on cut/pasting widgets and properties and dart messages showing errors/improper properties that aren't even there. Happy to show logs/diagnostics of everything I have, but this is an issue that continues to pop up over and over and over in the latest SDK. It's causing a great deal of frustration and actively slowing development. Quick-fixes will often break my code by injecting import statements directly into the middle of other import statements, making suggestions for things that don't exist, re-naming incorrect sections of code, or just taking anywhere from 5 to 30 seconds to update the AST breaking all code refactoring/fixes until the new AST is completed.

Workstation is a Pop_OS linux with upgraded drivers on an i9-9980XE, 64GB of Ram, latest version of Android Studio Dolphin 2021.3.1 Patch 1 and latest Flutter/Dark SDK's.

logs.zip

bwilkerson commented 1 year ago

@jwren @alexander-doroshko Might this be related to the line-ending issue reported elsewhere?

alexander-doroshko commented 1 year ago

@bwilkerson No, this is not related to that line-ending issue.

@firephreek First of all I see that logs are overfilled with the exceptions from the 3rd party 'Flutter Enhancement Suite' plugin. Please try to disable it and see if it makes any difference.

Second, I see freeze reports. Keywords are "sun.java2d.loops.Blit", "java2d.pipe.DrawImage", "SunGraphics2D", etc. I'm not an expert in this, unfortunately. Something is not great with JVM+Linux. I see that there are quite few issues with these words in JetBrains issue tracker: https://youtrack.jetbrains.com/. Among them I've met recommendations to upgrade or downgrade Linux version. There might be some other hints, I haven't read all these issues yet.

Next, you may try Android Studio Electric Eel RC (2022.1.x) or Android Studio Flamingo Canary (2022.2.x) or even IntelliJ IDEA 2022.3.

firephreek commented 1 year ago

@bwilkerson I can try those, but to be sure, these are issues that seem to have persisted across platforms. I was on Windows 10 before this (same hardware/IDE) and they seemed even worse. If anything, they've lessened on linux. Happy to disable FES, it doesn't seem to do much anyways, not sure how much I can do re: the JVM on linux. I'm pretty sure it's just using the JVM that AS is using. The Sun/2D issues could be a GNOME issue or it might be picking up problems in the emulator. I'll get a System UI crash in the Pixel 4/Play emulator image if I let it stay in one place too long.

Again, these are issues I've been noticing despite the platform/plugins, but I'll troubleshoot those and see what, if anything, changes.

KlausJokisuo commented 1 year ago

The analyzer has been working a bit better for a while unless you're generating code. If you're generating code you need to restart the analyzer quite often so it won't get stuck.

bwilkerson commented 1 year ago

Thank you, that's a useful data point.