Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
### Removed

### Fixed
- Silent failure when opening Flutter projects without `.idea` directory in IntelliJ IDEA, by removing `FlutterProjectOpenProcessor` and
migrating configuration logic to `FlutterInitializer`. (#8903)

## 91.0.0

Expand Down
2 changes: 0 additions & 2 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@
<!-- See https://github.com/flutter/flutter-intellij/issues/8029 -->
<projectService serviceImplementation="io.flutter.view.InspectorView" overrides="false"/>

<projectOpenProcessor id="flutter" implementation="io.flutter.project.FlutterProjectOpenProcessor" order="first"/>

<editorNotificationProvider implementation="io.flutter.editor.FlutterPubspecNotificationProvider"/>
<editorNotificationProvider implementation="io.flutter.inspections.SdkConfigurationNotificationProvider"/>
<editorNotificationProvider implementation="io.flutter.editor.NativeEditorNotificationProvider"/>
Expand Down
17 changes: 13 additions & 4 deletions src/io/flutter/FlutterInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
* Runs actions after the project has started up and the index is up to date.
*
* @see ProjectOpenActivity for actions that run earlier.
* @see io.flutter.project.FlutterProjectOpenProcessor for additional actions that
* may run when a project is being imported.
*/
public class FlutterInitializer extends FlutterProjectActivity {
private boolean toolWindowsInitialized = false;
Expand Down Expand Up @@ -115,8 +113,19 @@ public void executeProjectStartup(@NotNull Project project) {
}

log().info("Flutter module has been found for project: " + project.getName());
// Ensure SDKs are configured; needed for clean module import.
FlutterModuleUtils.enableDartSDK(module);

// Ensure Flutter project configuration is applied for projects that may have been
// opened without a .idea directory. Previously this was handled by FlutterProjectOpenProcessor,
// but that processor silently failed when no delegate processor could open the project.
// Instead, we let the platform open the project normally and apply our configuration here.
// See https://github.com/flutter/flutter-intellij/issues/8661 (Android Studio equivalent)
if (!FlutterModuleUtils.isFlutterModule(module)) {
log().info("Fixing Flutter module configuration for " + module.getName());
FlutterModuleUtils.setFlutterModuleWithoutReload(module, project);
} else {
// Ensure SDKs are configured; needed for clean module import.
FlutterModuleUtils.enableDartSDK(module);
}

for (PubRoot root : PubRoots.forModule(module)) {
// Set Android SDK.
Expand Down
107 changes: 0 additions & 107 deletions src/io/flutter/project/FlutterProjectOpenProcessor.kt

This file was deleted.

3 changes: 1 addition & 2 deletions src/io/flutter/utils/FlutterModuleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,14 @@ public static void setFlutterModuleType(@NotNull Module module) {
module.setModuleType(getModuleTypeIDForFlutter());
}

public static void setFlutterModuleAndReload(@NotNull Module module, @NotNull Project project) {
public static void setFlutterModuleWithoutReload(@NotNull Module module, @NotNull Project project) {
if (project.isDisposed()) return;
ApplicationManager.getApplication().invokeLater(() -> {
ApplicationManager.getApplication().runWriteAction(() -> setFlutterModuleType(module));
enableDartSDK(module);
project.save();

EditorNotifications.getInstance(project).updateAllNotifications();
ProjectManager.getInstance().reloadProject(project);
});
Comment thread
helin24 marked this conversation as resolved.
Comment thread
helin24 marked this conversation as resolved.
}

Expand Down
Loading