Skip to content

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Jul 29, 2025

If you start with a Dart-only workspace and later add a Flutter project, you'll now be prompted to reload:

Image

Fixes #5612

@DanTup DanTup added this to the v3.116.0 milestone Jul 29, 2025
@DanTup DanTup added is enhancement in flutter Relates to running Flutter apps labels Jul 29, 2025
@DanTup DanTup force-pushed the workspace-flutter-upgrade branch from a213a5b to d4beb85 Compare July 29, 2025 12:06
@DanTup DanTup requested a review from Copilot July 29, 2025 12:26
@DanTup
Copy link
Member Author

DanTup commented Jul 29, 2025

/gemini review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to prompt users to reload the VS Code extension when Flutter projects are added to a Dart-only workspace. The enhancement improves the user experience by automatically detecting new Flutter projects and offering to switch to Flutter SDK support.

  • Adds a new FlutterProjectWatcher class that monitors pubspec.yaml file changes
  • Implements cache clearing functionality to ensure fresh project detection after reload
  • Integrates the watcher into the extension activation process for Dart-only workspaces

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/shared/vscode/utils.ts Exports a new clearCaches function to reset project folder cache
src/shared/utils/cache.ts Adds a clear method to the SimpleTimeBasedCache class
src/extension/flutter/flutter_project_watcher.ts New class that watches for Flutter projects and prompts for reload
src/extension/extension.ts Integrates cache clearing and Flutter project watcher into extension activation

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a mechanism to detect when a Flutter project is added to a Dart-only workspace and prompts the user to reload. The implementation involves a new FlutterProjectWatcher that monitors pubspec.yaml files. The changes also include clearing project caches on activation to ensure new project types are detected after a reload. The overall approach is sound. I've provided one suggestion to improve the robustness of the new FlutterProjectWatcher by handling potential race conditions and improving resource management.

@DanTup DanTup force-pushed the workspace-flutter-upgrade branch from d4beb85 to 952c3f8 Compare July 29, 2025 12:34
@DanTup DanTup merged commit 7f51d4c into master Jul 29, 2025
21 checks passed
@DanTup DanTup deleted the workspace-flutter-upgrade branch July 29, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in flutter Relates to running Flutter apps is enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Unable to launch Flutter project in a Dart-only workspace" when trying to launch a Flutter app added to a non-Flutter workspace

2 participants