Skip to content

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Aug 13, 2025

The basic preview works and can be shown in the sidebar or as an editor panel (default is currently sidebar).

See #2620
See #5649

@DanTup DanTup added this to the v3.118.0 milestone Aug 13, 2025
@DanTup DanTup added is enhancement in flutter Relates to running Flutter apps in editor Relates to code editing or language features labels Aug 13, 2025
@DanTup DanTup changed the title Add basic Flutter Widget Preview Add basic (experimental) Flutter Widget Preview Aug 13, 2025
@DanTup DanTup requested a review from Copilot August 13, 2025 14:59
@DanTup
Copy link
Member Author

DanTup commented Aug 13, 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 experimental Flutter Widget Preview functionality that allows developers to preview Flutter widgets in VS Code through a web server interface. The feature can be displayed either in the sidebar or as an editor panel.

  • Adds a new Flutter Widget Preview server implementation that communicates with Flutter's widget-preview command
  • Implements webview-based preview functionality with both sidebar and embedded view options
  • Integrates the feature into the extension's configuration and activation flow with experimental flags

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/shared/vscode/utils.ts Refactors ProjectFinder to accept excluded folders function in constructor
src/shared/enums.ts Adds new log category for Flutter Widget Preview
src/shared/constants.contexts.ts Adds context constants for widget preview feature availability
src/shared/capabilities/flutter.ts Adds capability check for widget preview support
src/extension/views/packages_view.ts Updates to use refactored ProjectFinder API
src/extension/utils/log.ts Adds widget preview to user-selectable log categories
src/extension/flutter/widget_preview_server.ts Implements the Flutter widget preview server communication
src/extension/flutter/widget_preview/widget_preview_manager.ts Manages widget preview lifecycle and commands
src/extension/flutter/widget_preview/webviews.ts Implements webview components for displaying the preview
src/extension/extension.ts Integrates widget preview into main extension activation
src/extension/config.ts Adds configuration options for the experimental feature
src/extension/api/extension_api.ts Updates API to use refactored ProjectFinder
package.json Adds commands, configuration, and sidebar view definitions

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

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 an experimental Flutter Widget Preview feature. The implementation includes a new server process to generate the preview, webviews to display it (either in the sidebar or beside the editor), and associated commands and settings. The changes are well-structured, adding new modules for the preview functionality.

My review includes a few suggestions:

  • Correcting a potentially wrong icon path in package.json.
  • Fixing an invalid Content-Security-Policy in the webview implementation to improve security and correctness.
  • Improving type safety by changing any return types to void for dispose methods.

DanTup added 2 commits August 13, 2025 16:45
The basic preview works and can be shown in the sidebar or as an editor panel (default is currently sidebar).

See #2620
See #5649
@DanTup DanTup force-pushed the flutter-widget-preview branch from 0da5cb4 to afcb58f Compare August 13, 2025 15:45
@DanTup DanTup merged commit 8bc2de0 into master Aug 13, 2025
20 of 21 checks passed
@DanTup DanTup deleted the flutter-widget-preview branch August 13, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in editor Relates to code editing or language features in flutter Relates to running Flutter apps is enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants