Skip to content
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

Ability to disable opening the file when selecting widget from Widget Explorer #6561

Open
osaxma opened this issue Oct 19, 2023 · 12 comments
Open
Labels
fix it friday P2 important to work on, but not at the top of the work list. screen: inspector

Comments

@osaxma
Copy link

osaxma commented Oct 19, 2023

In VS Code, when I am only interested in viewing the widget in the Layout Explorer, opening the file takes a lot of space + it moves all panes in undesirable way.

It'd be nice to have a way to disable the file opener or have a separate action to open the file (right click menu or cmd+click combination).

devtools version: 2.25.0
VS Code version: 1.83.1
Dart extension: v3.74.0
@kenzieschmoll kenzieschmoll added screen: inspector P2 important to work on, but not at the top of the work list. fix it friday labels Oct 19, 2023
@kenzieschmoll
Copy link
Member

@DanTup could we add a setting in the Dart Code extension to allow disabling the jump to file behavior? This setting should default to true, but this would give users the ability to opt out.

@DanTup
Copy link
Contributor

DanTup commented Oct 19, 2023

@kenzieschmoll yep, we can do that. Although I wonder if it may be better controlling from DevTools (eg. don't send a navigate event)? That way it would apply to both editors rather than them have their own settings?

@kenzieschmoll
Copy link
Member

I think the navigate event is sent from the Flutter framework, and not DevTools. @CoderDake correct me if I am wrong.

@DanTup
Copy link
Contributor

DanTup commented Oct 23, 2023

I think you're right, although perhaps it could be toggled in a similar way to toggling inspect mode / debug painting etc.?

It's probably much more work (which might be an argument for doing it in VS Code) but I think it would be more visible there. Most users probably haven't scanned all of the settings in VS Code, but having some tickbox/toggle in the inspector for "Navigate IDE on select" would be much more discoverable (and isn't VS Code-specific).

WDYT? It's trivial to do only in VS Code and I'm happy to do that if you think it makes most sense.

@osaxma I'm also interested in this:

  • it moves all panes in undesirable way.

Could you elaborate on this (or file a Dart-Code issue)? If the real issue here isn't the navigation of that it's doing something bad in the editor, we should fix that. IIRC it was supposed to always navigate in an existing editor pane and not open or move any, but since the layouts have become much more flexible since it was added it's possible it's not doing this very well.

@osaxma
Copy link
Author

osaxma commented Oct 23, 2023

@DanTup:

I think opening the file will have to reorder the panes anyway so the file can fit in. But if my intention is not to open the file, then it's inconvenience since I've close the file every time I chose a widget to be shown in the layout explorer.

Screen.Recording.2023-10-23.at.1.22.07.PM.mov

In the video above, all files were closed before the recording and the Widget Inspector was the only open tab (I do this to have enough space).

@DanTup
Copy link
Contributor

DanTup commented Oct 23, 2023

Ah, I see. I wonder if we should never navigate to code if there is no code editor visible? Eg. if you're already running the inspector side-by-side then it'll navigate in the other code window, but if you're using it full-screen we don't open it (or if possible, we open it as a background tab so you can easily switch to it).

@osaxma @kenzieschmoll thoughts?

@osaxma
Copy link
Author

osaxma commented Oct 23, 2023

+1 for opening the file in the background (as a new temp tab) if there's no code editor open.

@DanTup
Copy link
Contributor

DanTup commented Oct 23, 2023

+1 for opening the file in the background (as a new temp tab) if there's no code editor open.

I should've looked for an API for this before suggesting it - unfortunately it doesn't seem like it's possible (except for showing then immediately switching back, but I suspect that'll look janky).

@CoderDake
Copy link
Contributor

I believe that the app itself currently sends the event, but we have the ability the move that behaviour into DevTools with the new custom Stream behaviour.
If we were to do that, then we could have a setting on the DevTools side.

@DanTup
Copy link
Contributor

DanTup commented Oct 26, 2023

There was a similar request from an IntelliJ user here: flutter/flutter-intellij#6875 (comment)

I do think having it as a toggle in DevTools might be more discoverable (as well as only need a single implementation)

@jacob314
Copy link
Contributor

Changing this in DevTools would also require changing package:flutter as current package:flutter dispatches events when inspector selection change that would need to be handled differently depending on this setting. In general I think that is a useful change. The way this is usually surfaced is by a button indicating whether state should be synced. The default should remain syncing the state of the selected widget with the code location but we need to support the alternate option of unsyncing the state. Keep in mind that syncing the source location with the IDE is the single most popular feature in the inspector so we will also need to take care that users don't accidentally disable it and then not understand what went wrong.

@artyomkonyaev
Copy link

any news here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix it friday P2 important to work on, but not at the top of the work list. screen: inspector
Projects
None yet
Development

No branches or pull requests

6 participants