-
Notifications
You must be signed in to change notification settings - Fork 340
Handle "new" response types from Flutter daemon's getSupportedPlatforms #5610
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
Conversation
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.
Summary of Changes
Hello @DanTup, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses a breaking change in the Flutter daemon's getSupportedPlatforms API, which recently removed its legacy response format. I've updated the Dart-Code extension to correctly parse the new response structure, ensuring that the extension can continue to accurately detect and display supported platforms for Flutter projects. This is a critical compatibility fix to maintain core functionality.
Highlights
- API Compatibility Update: I've updated the
SupportedPlatformsResponseinterface insrc/shared/flutter/daemon_interfaces.ts(lines 79-80) to accommodate the newplatformTypesfield returned by the Flutter daemon'sgetSupportedPlatformsmethod. The oldplatformsarray is now marked as legacy and optional. - Platform Detection Logic Refinement: The
tryGetSupportedPlatformsmethod insrc/shared/vscode/device_manager.tshas been renamed totryGetSupportedPlatformTypes(line 375) and its implementation (lines 381-382) now intelligently parses the daemon's response, extracting platform names from either the legacyplatformsarray or the newplatformTypesmap, ensuring backward and forward compatibility. - Integration Across Components: Calls to the updated platform detection logic have been adjusted in
src/extension/providers/debug_config_provider.ts(lines 174, 185) and withinsrc/shared/vscode/device_manager.tsitself (lines 367, 467, 471) to reflect the new method name and its simplifiedstring[]return type. - Unit Test Alignment: The unit tests in
src/test/flutter/device_manager.test.ts(lines 260-277) and theFakeFlutterDaemonmock (lines 338-341) have been updated to align with the newgetSupportedPlatformsresponse structure and the renamedtryGetSupportedPlatformTypesmethod, ensuring test coverage for the updated functionality.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request updates the handling of the getSupportedPlatforms response from the Flutter daemon to support the new format, which is a great improvement for compatibility. The changes are well-contained and correctly update the interface, implementation, and tests.
I've identified one high-severity correctness issue where the isSupported flag from the new API response is not being checked, which could lead to incorrect platform support detection. I've also found a minor typo in a test description.
My feedback includes suggestions to address these points to improve the correctness and quality of the code. Overall, this is a solid PR that addresses an important API 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.
Pull Request Overview
This PR updates the code to handle changes in Flutter daemon's getSupportedPlatforms response format. The Flutter daemon changed from returning a platforms array to a platformTypes object, and the legacy format was recently removed.
Key changes:
- Updated method names from
tryGetSupportedPlatformstotryGetSupportedPlatformTypes - Modified response handling to support both legacy
platformsarray and newplatformTypesobject format - Updated interface definitions to reflect the new response structure
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/shared/flutter/daemon_interfaces.ts | Updated SupportedPlatformsResponse interface to include both legacy and new format fields |
| src/shared/vscode/device_manager.ts | Renamed method and updated logic to handle both response formats with fallback |
| src/extension/providers/debug_config_provider.ts | Updated method calls to use the new method name |
| src/test/flutter/device_manager.test.ts | Updated test method names and mock implementation to use new format |
The format of this changed but we never updated, and the legacy format was recently removed. See flutter/flutter#140473, flutter/flutter#172593 Fixes #5606
91b5a3d to
898c84c
Compare
…lutter#172593)" This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
…172593)" (#172883) This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
…lutter#172593)" (flutter#172883) This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
…lutter#172593)" (flutter#172883) This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
…lutter#172593)" (flutter#172883) This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
…lutter#172593)" (flutter#172883) This reverts commit cfe6f3d. The change broke the vscode extension. The extension has been updated in Dart-Code/Dart-Code#5610 but it is worth keeping this for a little while longer.
The format of this changed but we never updated, and the legacy format was recently removed.
See flutter/flutter#140473, flutter/flutter#172593
Fixes #5606