-
Notifications
You must be signed in to change notification settings - Fork 308
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
Flutter gutter icons to not show for widgets inside conditional expressions #3196
Comments
@DanTup |
@PhoenixLeeSin are you able to trim your file down to something small you can share that still shows the problem? Perhaps with the same code I can reproduce it. |
@DanTup oh.....when i init a new flutter project, icons shows in left!!!! |
@PhoenixLeeSin can you try copying exactly the same code (ideally the whole file) into the small test project, and see if the same occurs there? |
@DanTup thank u reply, when i copy the whole file it occurs error..
|
@PhoenixLeeSin thanks! I was able to trim this down and it looks like it might be caused by the ternary operator: I'll see if I can find a way to handle this. Thanks! |
Thanks u Reply~ |
@bwilkerson this fails because I'm using the Flutter Outline data to locate icons, and for code with conditionals the then/else expressions are flat. This code: return Container(
child: true ? Icon(Icons.keyboard_arrow_down) : Container(),
); Produces an outline like: "children": [
{
"element": {
"range": /*...*/,
"name": "Icon(Icons.keyboard_arrow_down)",
"kind": "CONSTRUCTOR_INVOCATION"
},
"range": /*...*/,
"codeRange": /*...*/
}
] I had a look at handling this, and have a possible fix here (which supports conditionals both in https://dart-review.googlesource.com/c/sdk/+/192688/ Although I don't know if it's the correct/best fix. The conditional is not shown in the tree, so it looks a bit like a flat list even when some pair of the child nodes could be exclusive. Perhaps an additional node could be inserted, although it would add more to the tree (if/else in collections do not currently do that, they're just flattened, so this does match them). WDYT? |
I remember asking the question about I think that the solution in the referenced CL lgtm. |
Fixes Dart-Code/Dart-Code#3196. Change-Id: I369e48285329c808a092ff677440e159aa7a103b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192688 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is fixed by dart-lang/sdk@387e9d9. The fix ships in the Dart SDK (not the VS Code extension), so will show up only once you're on a newer SDK that includes that change. |
newer to flutter ans VS, in my mac it can show flutter icons when write code, but it can not show in left ...
I searched a lot of information but didn’t find the answer
flutter : Flutter 1.22.5 • channel stable
dart: 2.10.4 (stable)
VS: 1.54.1
Any suggestions are appreciated~~
The text was updated successfully, but these errors were encountered: