flutter / flutter/flutter-intellij
More helpful F1 help or code completion for closures as arguments
- Dominant language
- Java
- Stars
- 2k
- Forks
- 356
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 27
Description
## Steps to Reproduce
1. Start writing any of the widgets that take a closure (`AnimatedBuilder`, `StreamBuilder`, `FutureBuilder`, `ListView.builder`, `LayoutBuilder`, `CupertinoTabScaffold`, etc.).
2. Check parameters (Cmd-P). Notice how the closure doesn't have any type information. Even if it did, it would be something like `IndexedWidgetBuilder` or `TransitionBuilder` or `ControlsWidgetBuilder`, which doesn't make it obvious what the parameters are. (The only immediately obvious to me is `VoidCallback` but that's learned.)

3. Start writing the widget arguments. Here, _if you remember not to tab-complete immediately_, you can see what the closure should look like. To be honest, the first time I noticed that is today, when documenting this user journey.

4. After you tab-complete and have `builder: ` (or `onTap: ` or whatever), now you can access the signature of the closure anymore. Cmd-P gives back the untyped view:

### Expected behavior
Sorted by desirability, ascending:
A) The typedef of the closure is shown in the Cmd-P window.
B) The full signature of the closure is shown in the Cmd-P window.
C) The closure is written for me, and the cursor gets transported inside the body. For example, in the `AnimatedBuilder` example above, I write `builder: ` and `(context, child) {}` is written. The arguments are named after the typedef signature.
D) Same as above, but the closure is only _suggested_, so I can provide a member method instead of writing inline, without first deleting the auto-completion.
## Version info
Please paste the output of running `flutter doctor -v` here (available from the command
line or from `Tools > Flutter > Flutter Doctor`). It will provide the version of the
Flutter framework as well as of the IntelliJ plugin.
```
flutter doctor -v
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale en-US)
• Flutter version 1.7.8+hotfix.4 at /Users/filiph/dev/flutter
• Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/filiph/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2, Build version 10E125
• CocoaPods version 1.7.5
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 38.2.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.36.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.2.0
[✓] Connected device (1 available)
• Pixel 2 XL • 711KPZK0592485 • android-arm64 • Android 9 (API 28)
• No issues found!
```
Contributor guide
Assessment
This issue has not been assessed yet.