Skip to content

Commit 33df2ef

Browse files
Georgii Kostenkoclaude
authored andcommitted
Fix IntelliJ IDEA project open silent failure by removing FlutterProjectOpenProcessor
FlutterProjectOpenProcessor silently failed to open Flutter projects without a .idea directory because getDelegateImportProvider() returned null when no other processor could claim the project. Since this processor was registered with order="first", no fallback occurred. Apply the same fix pattern as PR flutter#8710 (Android Studio): - Remove FlutterProjectOpenProcessor.kt - Remove its <projectOpenProcessor> registration from plugin.xml - Add module-type-fixing logic to FlutterInitializer (startup activity) This lets the platform's default project opener handle opening, then FlutterInitializer configures Flutter module type and Dart SDK after the project is loaded. Fixes flutter#8845 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 24d11f2 commit 33df2ef

3 files changed

Lines changed: 12 additions & 111 deletions

File tree

resources/META-INF/plugin.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,6 @@
335335
<!-- See https://github.com/flutter/flutter-intellij/issues/8029 -->
336336
<projectService serviceImplementation="io.flutter.view.InspectorView" overrides="false"/>
337337

338-
<projectOpenProcessor id="flutter" implementation="io.flutter.project.FlutterProjectOpenProcessor" order="first"/>
339-
340338
<editorNotificationProvider implementation="io.flutter.editor.FlutterPubspecNotificationProvider"/>
341339
<editorNotificationProvider implementation="io.flutter.inspections.SdkConfigurationNotificationProvider"/>
342340
<editorNotificationProvider implementation="io.flutter.editor.NativeEditorNotificationProvider"/>

src/io/flutter/FlutterInitializer.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
* Runs actions after the project has started up and the index is up to date.
6868
*
6969
* @see ProjectOpenActivity for actions that run earlier.
70-
* @see io.flutter.project.FlutterProjectOpenProcessor for additional actions that
71-
* may run when a project is being imported.
7270
*/
7371
public class FlutterInitializer extends FlutterProjectActivity {
7472
private boolean toolWindowsInitialized = false;
@@ -97,6 +95,18 @@ public void executeProjectStartup(@NotNull Project project) {
9795
// Start a DevTools server
9896
DevToolsService.getInstance(project);
9997

98+
// Ensure Flutter project configuration is applied for projects that may have been
99+
// opened without a .idea directory. Previously this was handled by FlutterProjectOpenProcessor,
100+
// but that processor silently failed when no delegate processor could open the project.
101+
// Instead, we let the platform open the project normally and apply our configuration here.
102+
// See https://github.com/flutter/flutter-intellij/issues/8661 (Android Studio equivalent)
103+
for (Module module : FlutterModuleUtils.getModules(project)) {
104+
if (FlutterModuleUtils.declaresFlutter(module) && !FlutterModuleUtils.isFlutterModule(module)) {
105+
log().info("Fixing Flutter module configuration for " + module.getName());
106+
FlutterModuleUtils.setFlutterModuleAndReload(module, project);
107+
}
108+
}
109+
100110
// If the project declares a Flutter dependency, do some extra initialization.
101111
boolean hasFlutterModule = false;
102112

src/io/flutter/project/FlutterProjectOpenProcessor.kt

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)