flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.95k stars 314 forks source link

"Pubspec has been edited" is stuck in Android Studio Koala 2024.1.1.11 #7538

Open RoarGronmo opened 6 days ago

RoarGronmo commented 6 days ago

Steps to reproduce

  1. Do a change in the pubspec.yaml file in an existing Flutter project (In IDE Android Studio Koala 2024.1.1.11)
  2. You will be warned by the "Pubspec has been edited" banner.
  3. Click Get or Update
  4. The banner does not disappear after get or update.
  5. Click the "Ignore" button, it will still stay stuck.

It is random if all or just some of the banners shows for each file in the IDE.

image

Expected results

The banner should disappear when upgrade or get process are done

Actual results

The banner stay stuck for all or some of the files.

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [√] Flutter (Channel beta, 3.23.0-0.1.pre, on Microsoft Windows [Version 10.0.22631.3737], locale nb-NO) • Flutter version 3.23.0-0.1.pre on channel beta at C:\Flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2feea7a407 (3 weeks ago), 2024-06-06 10:19:10 +0700 • Engine revision bb10c54666 • Dart version 3.5.0 (build 3.5.0-180.3.beta) • DevTools version 2.36.0 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc1) • Android SDK at c:/android/sdk • Platform android-35, build-tools 35.0.0-rc1 • Java binary at: C:\Program Files\Android Studio\Android Studio 2024.1.1.11\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.10.34928.147 • Windows 10 SDK version 10.0.22621.0 [√] Android Studio (version 2023.3) • Android Studio at C:\Program Files\Android Studio\Android Studio 2023.3.1.20 • 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 17.0.10+0--11572160) [√] Android Studio (version 2024.1) • Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.1.11 • 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 17.0.10+0--11609105) [√] Android Studio (version 2024.1) • Android Studio at C:\Program Files\Android Studio\Android Studio 2024.1.2.6 • 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 17.0.11+0--11852314) [√] Connected device (4 available) • SM T515 (mobile) • R52NB09L7ZP • android-arm • Android 11 (API 30) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3737] • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.63 • Edge (web) • edge • web-javascript • Microsoft Edge 126.0.2592.68 [√] Network resources • All expected network resources are available. • No issues found! ```
jwren commented 4 days ago

Reproduced, this has to do with the PubRoot.hasUpToDatePackages() method, the VirtualFile time stamps aren't coming back correct until the IntelliJ platform goes through to re-sync the file system. Calling the refresh APIs with VirtualFiles isn't sufficient, that is, I found the following to be true: https://intellij-support.jetbrains.com/hc/en-us/community/posts/8009750602514-VirtualFile-is-not-refreshed. The solution described of creating PSI instances is too heavy-weight.

Creating instances of java.io.File objects and comparing the timestamps seems to fix this issue, but creating these instances isn't great in practice either.