Skip to content

Print DevTools inspector links in RenderFlex Overflow errors#74251

Merged
fluttergithubbot merged 15 commits intoflutter:masterfrom
kenzieschmoll:devtools-server-in-flutter
Jan 21, 2021
Merged

Print DevTools inspector links in RenderFlex Overflow errors#74251
fluttergithubbot merged 15 commits intoflutter:masterfrom
kenzieschmoll:devtools-server-in-flutter

Conversation

@kenzieschmoll
Copy link
Member

@kenzieschmoll kenzieschmoll commented Jan 19, 2021

  • Adds activeDevToolsServerAddress service extension to Flutter. flutter_tools will invoke this on run and attach, at which point the value will be the address of the server flutter_tools launched or the address that was provided via the --devtools-server-address flag.
  • Adds a line to render overflow errors that provides users with a link to open the error-causing widget in the DevTools inspector

Screen Shot 2021-01-20 at 5 03 49 PM

@helin24 @jacob314 @jonahwilliams

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 19, 2021
@google-cla google-cla bot added the cla: yes label Jan 19, 2021
import 'dart:ui' as ui;

import 'package:flutter/foundation.dart';
import 'package:flutter/src/widgets/framework.dart';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a layering violation - rendering shouldn't know about widgets. I would ask the framework folks what a better way to structure this would be.

Copy link
Member Author

Choose a reason for hiding this comment

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

@goderbauer do you have some guidance here? we need access to some of the code in widget_inspector.dart

Copy link
Member

Choose a reason for hiding this comment

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

Could you utilise a DiagnosticPropertiesTransformer (added to FlutterErrorDetails.propertiesTransformers [1]) to change the information collected in a lower level to something more actionable in a higher level?

We use this mechanism to enrich errors in the rendering layer with additional information from the widget layer.

[1] https://master-api.flutter.dev/flutter/foundation/FlutterErrorDetails/propertiesTransformers.html

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this method already dips into that mechanism: line 265 below adds a DiagnosticsDebugCreator, which gets processed by the widget_insepctor (via one of those transformers) here:

You may be able to reuse that transformer (or add a new one for your purposes).

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved error diagnostic code into property transformer. @goderbauer PTAL

@kenzieschmoll kenzieschmoll force-pushed the devtools-server-in-flutter branch from 1492b03 to 7ac18e9 Compare January 20, 2021 21:24
@jonahwilliams
Copy link
Contributor

I'm going to try to fix run_cold.dart so that run always calls attach

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

Tool changes LGTM

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

framework LGTM

/// * [BindingBase.initServiceExtensions], which explains when service
/// extensions can be used.
void initServiceExtensions(_RegisterServiceExtensionCallback registerServiceExtensionCallback) {
developer.Service.getInfo().then((developer.ServiceProtocolInfo info) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need to be conditionally disabled on the web.

}
vmService.onExtensionEvent.listen((vm_service.Event event) {
if (event.json['extensionKind'] == 'Flutter.FrameworkInitialization') {
completer.complete();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like there can be more than one of these.

Copy link
Member Author

Choose a reason for hiding this comment

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

See - #74407. Working on a fix now. Have the fix - just working on the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants