-
Notifications
You must be signed in to change notification settings - Fork 329
Fix IllegalStateException in ProjectOpenProcessor #8633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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
CHANGELOG.md
Outdated
| ### 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Significantly, this would address a more impacting IllegalStateException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
| "src", | ||
| "third_party/vmServiceDrivers" | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required by your change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to avoid runtime issues with the Kotlin files being introduced.
|
|
||
| override fun canOpenProject(file: VirtualFile): Boolean { | ||
| val root = PubRoot.forDirectory(file) | ||
| return root != null && root.declaresFlutter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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
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