Skip to content

Open embedded DevTools Inspector to error-causing widget for Flutter render overflow errors #3088

Closed

Description

@kenzieschmoll

As of flutter/flutter#74251, deep links to the inspector are printed in error messages for render overflow errors. The structured error for this will contain a diagnostics node of type DevToolsDeepLinkProperty (the diagnostics node naming is in progress flutter/flutter#74455). Right now the diagnostics node looks like:

{
	"description": "To inspect this widget in Flutter DevTools, visit: http://127.0.0.1:9100/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A53813%2FiJkJsuFOUyY%3D%2F&inspectorRef=inspector-0",
	"type": "DiagnosticsProperty<void>",
	"name": "",
	"showName": false,
	"style": "singleLine",
	"allowNameWrap": true,
	"objectId": "inspector-12",
	"valueId": null,
	"properties": [],
	"children": [],
	"missingIfNull": false,
	"propertyType": "void",
	"defaultLevel": "info",
	"value": null
},

VS code should

  1. upon receiving an error like this, show a prompt that warns the user that something went wrong and gives them a button to inspect the error-causing widget in the embedded DevTools inspector.
  2. take over the rendering of this diagnostics node in the console. We don't want a link in the console that will take the user to the chrome version of DevTools at the same time that we show a prompt that will take the user to the embedded version of DevTools.
  3. Generally, show the link in the console as is if the user is not opted into embedded DevTools, and do not show the link in the console if we are using the prompt

We need an MVP of this by end of next week, if possible (for demo recording purposes). Ideally to be included in the release next week.

Partner issue in the flutter-intellij plugin: flutter/flutter-intellij#5198

Some edge cases we should complete as follow ups:

  • What if there are multiple errors at once? Do we collapse the notifications? Always show the last?
  • Provide users with an option "Don't show me messages like these" or similar. If the user does this, we should revert back to displaying the deep link in the console.

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jan 21, 2021
  2. added this to the v3.20.0 milestone on Jan 25, 2021
  3. added
    in commandsRelates to commands (usually invoked from the command Palette)
    in flutterRelates to running Flutter apps
    on Jan 25, 2021
  4. DanTup commented on Jan 26, 2021

    @DanTup
    Member

    Here's how this shows up now, including the text replacement:

    Screenshot 2021-01-26 at 10 11 20

    What if there are multiple errors at once? Do we collapse the notifications? Always show the last?

    Currently I'm preventing another from appearing for 5 seconds after one appears (unless you close it) to try and avoid them flashing in VS Code (if they have the same text, the new one would replace the previous, but it would animate and look spammy if it has firing a lot). I've done this assuming the inspectorRef from the first one would still be valid. If that's not the case, let me know and I'll remove this so they just get replaced (it'll result in the animation replaying, but that would be better than a broken button).

    Provide users with an option "Don't show me messages like these" or similar. If the user does this, we should revert back to displaying the deep link in the console.

    Done! This is stored as a VS Code user setting, so the user can easily toggle it on/off from the settings too.

    @kenzieschmoll I wasn't planning on including this in this months release as it's only activated when passing --devtools-server-address to Flutter and I haven't merged that yet (I need a good version number to know when it's safe to pass but I don't think there's been one since it landed). If you think it should definitely be included, let me know and I'll check again for a version number before releasing.

  5. added a commit that references this issue on Jan 26, 2021
    631b05e
  6. kenzieschmoll commented on Jan 26, 2021

    @kenzieschmoll
    Author

    FYI here is the landed implementation in the flutter intellij plugin flutter/flutter-intellij#5207

  7. kenzieschmoll commented on Jan 26, 2021

    @kenzieschmoll
    Author

    I wasn't planning on including this in this months release as it's only activated when passing --devtools-server-address to Flutter and I haven't merged that yet (I need a good version number to know when it's safe to pass but I don't think there's been one since it landed).

    @helin24 gated the change off of the correct flutter version here: flutter/flutter-intellij#5176. If we can get both passing the --devtools-server-address and the notification for overflow errors landed in VS code for this release, that would be good for consistency between the two tools.

  8. DanTup commented on Jan 26, 2021

    @DanTup
    Member

    @helin24 gated the change off of the correct flutter version here: flutter/flutter-intellij#5176

    Aha, thanks - I thought the versions weren't comparable until the dev release, but that looks simple enough - thanks!

  9. modified the milestones: v3.20.0, v3.19.0 on Jan 26, 2021
  10. added 2 commits that reference this issue on Jan 27, 2021
    9e81789
    71ab22a
  11. DanTup commented on Jan 27, 2021

    @DanTup
    Member

    @kenzieschmoll should --devtools-server-address be supported for flutter attach? I found a bug where I was trying to send it to all flutter invocations (flutter run, flutter test, flutter attach). I've changed this to only flutter run, though perhaps attach should be supported?

  12. DanTup commented on Jan 27, 2021

    @DanTup
    Member

    @kenzieschmoll I merged this and published a new beta here: https://github.com/Dart-Code/Dart-Code/releases/tag/v3.19.0-beta.2

    Provisional release notes here: https://dartcode.org/releases/v3-19/

  13. kenzieschmoll commented on Jan 27, 2021

    @kenzieschmoll
    Author

    flutter attach should support the flag as well 🤔 I'll look into it - thanks for the heads up.

  14. DanTup commented on Jan 27, 2021

    @DanTup
    Member

    @kenzieschmoll I think I misread the error when I tested at the terminal - the one for flutter test said "Could not find an option named" and the one for flutter attach said "Missing argument for" 🤦‍♂️

    So I think it's work as expected, and I'll remove the exclusion for attach here and only exclude test. Sorry for the confusion!

  15. kenzieschmoll commented on Jan 27, 2021

    @kenzieschmoll
    Author

    Perfect - thanks. One question - if a user clicks never ask, do we go back to showing the user the deep link as part of the error message in the console?

  16. DanTup commented on Jan 27, 2021

    @DanTup
    Member

    @kenzieschmoll we do, although only from the next debug session (although the popups will be immediately suppressed).

    The settings are sent to the debug adapter at the start of a session (the debug adapter rewrites the message) but the UI/extension code is in a completely separate process, so it's a little complicated to update during a session (though it is possible).

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

Metadata

Metadata

Assignees

Labels

in commandsRelates to commands (usually invoked from the command Palette)in flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions