Skip to content

Conversation

@jwren
Copy link
Member

@jwren jwren commented Dec 4, 2025

Migrate FlutterProjectOpenProcessor and FlutterStudioProjectOpenProcessor from the deprecated doOpenProject to openProjectAsync to fix compatibility with IntelliJ IDEA 2025.3+.

This change involves:

  • Converting FlutterProjectOpenProcessor to Kotlin.
  • Converting FlutterStudioProjectOpenProcessor to Kotlin.
  • Implementing openProjectAsync using writeAction for project setup.
  • Enabling Kotlin compilation for the main source set in build.gradle.kts.

Fixes #8629 See https://plugins.jetbrains.com/docs/intellij/project-open-processor.html

@jwren jwren requested review from helin24 and pq December 4, 2025 22:56
@pq
Copy link
Collaborator

pq commented Dec 5, 2025

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 flutter create or maybe it's more broadly applicable than that?) Maybe it'd be better to just remove the processor entirely? Open question!

@jwren
Copy link
Member Author

jwren commented Dec 5, 2025

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 flutter create or maybe it's more broadly applicable than that?) Maybe it'd be better to just remove the processor entirely? Open question!

100%! I could not convince myself that that approach would be less risky.

@jwren jwren force-pushed the fix-2025_3_ea branch 2 times, most recently from 975919b to e67a469 Compare December 9, 2025 04:21
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)
Copy link
Collaborator

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.

Copy link
Member Author

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"
)
)
Copy link
Collaborator

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?

Copy link
Member Author

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()
Copy link
Collaborator

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() == true

or even more terse with expression bodies:

override fun canOpenProject(file: VirtualFile): Boolean = 
    PubRoot.forDirectory(file)?.declaresFlutter() == true

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

jwren added 2 commits December 9, 2025 20:02
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot open any Flutter project with latest IDEA EA release

3 participants