Fix IllegalStateException in ProjectOpenProcessor#8633
Conversation
|
Nice! Before we land this, I'm inclined to ask another question: are we sure we don't want to just remove this processor? Are we sure that the conditions that motivated it are common in the wild? (That is, flutter projects created outside of a workflow using |
100%! I could not convince myself that that approach would be less risky. |
975919b to
e67a469
Compare
| ### Fixed | ||
|
|
||
| - Fixed crash when using 3rd party loggers that don't implement `setLevel`. (#8631) | ||
| - Fixed "Slow operations are prohibited on EDT" by migrating `FlutterProjectOpenProcessor` to Kotlin and using `openProjectAsync`. (#8629) |
There was a problem hiding this comment.
Significantly, this would address a more impacting IllegalStateException.
| "src", | ||
| "third_party/vmServiceDrivers" | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Is this required by your change?
There was a problem hiding this comment.
Yes to avoid runtime issues with the Kotlin files being introduced.
There was a problem hiding this comment.
Got it, thanks. Are there any kotlin files in vmServiceDrivers? (Or will there be?)
|
|
||
| override fun canOpenProject(file: VirtualFile): Boolean { | ||
| val root = PubRoot.forDirectory(file) | ||
| return root != null && root.declaresFlutter() |
There was a problem hiding this comment.
Maybe consider the "simpler":
return root?.declaresFlutter() == trueor even more terse with expression bodies:
override fun canOpenProject(file: VirtualFile): Boolean =
PubRoot.forDirectory(file)?.declaresFlutter() == true?
Migrate [FlutterProjectOpenProcessor](cci:2://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/project/FlutterProjectOpenProcessor.kt:21:0-89:1) and [FlutterStudioProjectOpenProcessor](cci:2://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/editor/FlutterStudioProjectOpenProcessor.kt:17:0-61:1) from the deprecated [doOpenProject](cci:1://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/editor/FlutterStudioProjectOpenProcessor.kt:54:2-60:3) to [openProjectAsync](cci:1://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/project/FlutterProjectOpenProcessor.kt:38:2-54:3) to fix compatibility with IntelliJ IDEA 2025.3+. This change involves: - Converting [FlutterProjectOpenProcessor](cci:2://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/project/FlutterProjectOpenProcessor.kt:21:0-89:1) to Kotlin. - Converting [FlutterStudioProjectOpenProcessor](cci:2://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/editor/FlutterStudioProjectOpenProcessor.kt:17:0-61:1) to Kotlin. - Implementing [openProjectAsync](cci:1://file:///usr/local/google/home/jwren/src/flutter-intellij/src/io/flutter/project/FlutterProjectOpenProcessor.kt:38:2-54:3) using `writeAction` for project setup. - Enabling Kotlin compilation for the main source set in [build.gradle.kts](cci:7://file:///usr/local/google/home/jwren/src/flutter-intellij/build.gradle.kts:0:0-0:0). Fixes flutter#8629 See https://plugins.jetbrains.com/docs/intellij/project-open-processor.html
| "src", | ||
| "third_party/vmServiceDrivers" | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Got it, thanks. Are there any kotlin files in vmServiceDrivers? (Or will there be?)
Migrate FlutterProjectOpenProcessor and FlutterStudioProjectOpenProcessor from the deprecated doOpenProject to openProjectAsync to fix compatibility with IntelliJ IDEA 2025.3+.
This change involves:
writeActionfor project setup.Fixes #8629 See https://plugins.jetbrains.com/docs/intellij/project-open-processor.html