-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[ Widget Preview ] Improve IDE integration support #176114
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
This change adds support for two DTD Editor service RPCs and makes functionality that's dependent on the availability of the Editor service reactive to the service availability changing. The newly added `getActiveLocation` Editor RPC now allows for us to properly determine which source file is selected at startup, removing the need for special casing around initializing the filtered preview set. The `navigateToCode` Editor RPC is now supported, and URIs in stack traces can now be clicked to navigate to the source location in the IDE. Both filtering previews by selected file and stack frame navigation links are only enabled when the Editor service is available. Fixes #176113
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 significantly improves IDE integration for widget previews by adding support for getActiveLocation and navigateToCode DTD Editor service RPCs. This enables features like filtering previews by the selected file and navigating to source code from stack traces, which are now reactive to the editor service's availability. The changes are well-structured and include corresponding test updates. I've identified one critical logic bug in an error handling condition and a few areas where documentation for new public APIs is missing, which would improve maintainability.
packages/flutter_tools/templates/widget_preview_scaffold/lib/src/dtd/utils.dart.tmpl
Outdated
Show resolved
Hide resolved
packages/flutter_tools/templates/widget_preview_scaffold/lib/src/dtd/editor_service.dart.tmpl
Show resolved
Hide resolved
packages/flutter_tools/templates/widget_preview_scaffold/lib/src/dtd/editor_service.dart.tmpl
Show resolved
Hide resolved
|
@DanTup would you be okay to review this? No pressure if not! |
packages/flutter_tools/templates/widget_preview_scaffold/lib/src/dtd/editor_service.dart.tmpl
Outdated
Show resolved
Hide resolved
...s/flutter_tools/templates/widget_preview_scaffold/lib/src/widget_preview_rendering.dart.tmpl
Outdated
Show resolved
Hide resolved
packages/flutter_tools/test/commands.shard/permeable/widget_preview/dtd_services_test.dart
Outdated
Show resolved
Hide resolved
| case DTDEvent( | ||
| kind: kServiceRegistered, | ||
| data: {DtdParameters.service: kEditorService}, | ||
| ): | ||
| _editorServiceAvailable.value = true; |
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.
This additional check added in the last commit might affect already-shipped versions of Dart-Code (where people have enabled the preview), since those versions register many Editor services, but neither getActiveLocation or navigateToCode (they are only currently in pre-releases).
I don't know if that's a big deal though (it's an opt-in experiment, the update will ship next week, and you might have error handling that handles them not existing), but I'll let you decide :-)
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.
Yeah, I'm not too concerned here, especially with VSCode auto-updating the Dart-Code plugin. I don't think this would cause any noticeable breakages :)
|
autosubmit label was removed for flutter/flutter/176114, because - The status or check suite Mac_arm64 tool_tests_commands has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Roll Flutter from 6cc976ec26d3 to 96fe3b3df509 (32 revisions) flutter/flutter@6cc976e...96fe3b3 2025-09-29 [email protected] Roll Packages from 389c678 to 34eec78 (6 revisions) (flutter/flutter#176205) 2025-09-29 [email protected] Roll Skia from 9b2b942d1eb1 to bb3b6bd4be0d (4 revisions) (flutter/flutter#176201) 2025-09-29 [email protected] [ Widget Preview ] Improve IDE integration support (flutter/flutter#176114) 2025-09-29 [email protected] Fix name of driver file (flutter/flutter#176186) 2025-09-29 [email protected] Roll Skia from beb673968802 to 9b2b942d1eb1 (3 revisions) (flutter/flutter#176190) 2025-09-28 [email protected] Roll Fuchsia Linux SDK from 0Z45OXT_Wb8aWI3a0... to 8zjcJic_DtvB2Bo2x... (flutter/flutter#176158) 2025-09-28 [email protected] Revert "[Impeller] Optimize scale translate rectangle transforms" (flutter/flutter#176161) 2025-09-27 [email protected] Roll Skia from 2e5da5c0a9cd to beb673968802 (1 revision) (flutter/flutter#176145) 2025-09-27 [email protected] [Impeller] Optimize scale translate rectangle transforms (flutter/flutter#176123) 2025-09-27 [email protected] Roll Skia from d8422aaf8f89 to 2e5da5c0a9cd (2 revisions) (flutter/flutter#176141) 2025-09-27 [email protected] [web] Remove mention of non-existent `canvaskit_lock.yaml` (flutter/flutter#176108) 2025-09-27 [email protected] Roll Skia from 96b73f61fe61 to d8422aaf8f89 (2 revisions) (flutter/flutter#176118) 2025-09-27 [email protected] [a11y] Add `expanded` flag support to Android. (flutter/flutter#174981) 2025-09-26 [email protected] Make sure that a DesktopTextSelectionToolbar doesn't crash in 0x0 env… (flutter/flutter#173928) 2025-09-26 [email protected] Roll Dart SDK from 899c7340cc4c to af31d2637b6b (11 revisions) (flutter/flutter#176056) 2025-09-26 [email protected] Update java version ranges with the top end limitation for java pre 17 (flutter/flutter#176049) 2025-09-26 [email protected] Add warn java evaluation to android_workflow (flutter/flutter#176097) 2025-09-26 [email protected] Removes type annotations in templates (flutter/flutter#176106) 2025-09-26 [email protected] Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#175917) 2025-09-26 [email protected] Add kotlin/kgp 2.2.* evaluation criteria. (flutter/flutter#176094) 2025-09-26 [email protected] Migrate to `WidgetStateMouseCursor` (flutter/flutter#175981) 2025-09-26 [email protected] Roll Packages from 117bf63 to 389c678 (4 revisions) (flutter/flutter#176092) 2025-09-26 [email protected] Fix link to .gclient setup instructions (flutter/flutter#176046) 2025-09-26 [email protected] Implement Regular Windows for the win32 framework + add an example application for regular windows (flutter/flutter#173715) 2025-09-26 [email protected] Roll Skia from 5d99c3fc7c83 to 96b73f61fe61 (3 revisions) (flutter/flutter#176075) 2025-09-26 [email protected] Roll Fuchsia Linux SDK from naeytagBIBEpKgZNZ... to 0Z45OXT_Wb8aWI3a0... (flutter/flutter#176068) 2025-09-26 [email protected] Add itemClipBehavior property for CarouselView's children (flutter/flutter#175324) 2025-09-26 [email protected] Roll Skia from 55436d87e414 to 5d99c3fc7c83 (4 revisions) (flutter/flutter#176060) 2025-09-26 [email protected] Revert "[Impeller] Optimize scale translate rectangle transforms" (flutter/flutter#176061) 2025-09-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reapply "Update the AccessibilityPlugin::Announce method to account f… (#174365)" (flutter/flutter#176059) 2025-09-25 [email protected] Make sure that a CupertinoDesktopTextSelectionToolbarButton doesn't c… (flutter/flutter#173894) 2025-09-25 [email protected] Improve code quality in `SensitiveContentPluginTest.java` (flutter/flutter#175721) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md ...
This change adds support for two DTD Editor service RPCs and makes functionality that's dependent on the availability of the Editor service reactive to the service availability changing. The newly added `getActiveLocation` Editor RPC now allows for us to properly determine which source file is selected at startup, removing the need for special casing around initializing the filtered preview set. The `navigateToCode` Editor RPC is now supported, and URIs in stack traces can now be clicked to navigate to the source location in the IDE. Both filtering previews by selected file and stack frame navigation links are only enabled when the Editor service is available. Fixes flutter#176113
This change adds support for two DTD Editor service RPCs and makes functionality that's dependent on the availability of the Editor service reactive to the service availability changing.
The newly added
getActiveLocationEditor RPC now allows for us to properly determine which source file is selected at startup, removing the need for special casing around initializing the filtered preview set.The
navigateToCodeEditor RPC is now supported, and URIs in stack traces can now be clicked to navigate to the source location in the IDE.Both filtering previews by selected file and stack frame navigation links are only enabled when the Editor service is available.
Fixes #176113