-
Notifications
You must be signed in to change notification settings - Fork 300
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
Wrap with column missing in flutter IDEs #2492
Comments
Ok, so it turns out you need to right-click and not highlight the widget and then right click. Wrap in column showed as soon as I did this. |
@bwilkerson @scheglov does this seem like a bug? When invoking the assist menu one character from the end of a widget class, Wrap in Row/Column show up. However if the cursor is after the last character, they do not (however the others do). I can't think of a reason for this (nor can I see an obvious reason from the code why this happens): |
I can't think of any valid reason for the behavior being different between these two selection locations, so I'd consider this to be a bug. Note that "Wrap with Row" is also missing. Both it and "Wrap with Column" are implemented in a single method. That method uses |
Ok, took a quick look at this. When the cursor is inside the name of the widget,
The selection analyzer picks up the argument list Removing I'm not sure what a good fix is. If feels like the cursor being to the left of a paren in an argument list maybe should not be treated as being in the argument list, but that also feels like a weird exception. |
A possible short-term work around would be to check in the assists to see whether the covering node is an argument list whose parent is a widget expression. If we add a comment explaining why we're doing it, then we'd have some context in case we decide to change @scheglov I'm interested in your thoughts on this. |
@scheglov do you have any additional thoughts on this? If not, I might have a go at doing what @bwilkerson suggested above. Thanks! |
A note on implementation. In order to better support being able to apply multiple fixes simultaneously, we changed the way we're implementing both fixes and assists. They now use instances of a subclass of Prior to these changes, fixes and assists each had a slightly different way of computing the node used as the starting point for creating the edits. Usually they produced the same node, but in a few cases they differed. In the new architecture they are consistent. That has meant that sometimes when converting a fix or assist we've had to update the code slightly to adjust for the change in starting node. So, if you're interested in looking into this, it would be good if you first converted the existing assist to use the |
It is mostly a matter of covering reasonable cases. |
Looks like you beat me to this :-)
I think we could specifically handle the case where the caret is at exactly the offset of the argument list (eg. the caret is to the left of the open paren) - |
lgtm |
…nt list Bug: Dart-Code/Dart-Code#2492 Change-Id: I296f9396b3eedcbd1a63f272ed34c65f9d95d83b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152521 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Still happening as described here
|
Yes, that looks like a bug. The question is: does the version of the Flutter SDK that you're using include the fix. It sometimes takes a long time for a fix to make it into a build. Unfortunately, I can't remember how to determine that information, even if I knew which version of the Flutter SDK you're using. |
I can reproduce this, but it's slightly different to the original report/fix - in that case the cursor was at the end of
|
…or names selected Fixes Dart-Code/Dart-Code#2492. Change-Id: I5347e3ade842c3a155809e5224ca0ab40dd8651b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234285 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
With dart-lang/sdk@8480657, these actions will also work if the whole widget name is selected. The fix is in the SDK so will ship with a future Flutter SDK release (rather than the Dart extension for VS Code). |
I've tried this in both Android Studio and VSCode, but the context menu to wrap in column simply doesn't appear for me. I'm trying to follow a layout tutorial, but I get this error at pretty much the first hurdle. Has this feature been removed/replaced? Anyone got any ideas?
Here's what the guide looks like:
https://i.stack.imgur.com/fpKV2.jpg
And here's what I see:
https://i.stack.imgur.com/yZu5M.jpg
The text was updated successfully, but these errors were encountered: