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

Add auto assist for the map literal creation for routes #2929

Open
zoechi opened this issue Dec 7, 2018 · 3 comments
Open

Add auto assist for the map literal creation for routes #2929

zoechi opened this issue Dec 7, 2018 · 3 comments
Milestone

Comments

@zoechi
Copy link

zoechi commented Dec 7, 2018

@branflake2267 commented on Wed Apr 04 2018

I'd like to suggest adding auto assist completion for the map literal with types for the Scaffold routes argument. Something like the children literal array is created for ListView could be useful.

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
      // ~~~ auto assist could create this...
      routes: <String, WidgetBuilder>{
         // insert caret
      },
    );
  }
}

screen shot 2018-04-03 at 7 35 34 pm

Steps to Reproduce

  1. add the routes: property for scaffold
  2. key in control + space to try to auto assist completion

Logs

Nothing useful.

Flutter Doctor

brandons-mbp:flutter_preferences branflake2267$ flutter doctor -v
[✓] Flutter (Channel master, v0.2.9-pre.17, on Mac OS X 10.13.3 17D102, locale en-US)
    • Flutter version 0.2.9-pre.17 at /Users/branflake2267/git/flutter
    • Framework revision 7a6a65a597 (12 minutes ago), 2018-04-03 19:31:08 -0700
    • Engine revision 04f3c6557c
    • Dart version 2.0.0-dev.43.0.flutter-52afcba357

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/branflake2267/Library/Android/sdk
    • Android NDK at /Users/branflake2267/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.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-1024-b01)
    ✗ Android license status unknown.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.3, Build version 9E145
    • ios-deploy 1.9.2
    • CocoaPods version 1.4.0

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 23.1.3
    • Dart plugin version 181.4203.498

[✓] IntelliJ IDEA Community Edition (version 2017.3.5)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 22.2.2
    • Dart plugin version 173.4700

[✓] VS Code (version 1.21.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Dart Code extension version 2.11.1

[!] Connected devices
    ! No devices available

! Doctor found issues in 2 categories.

@zoechi commented on Fri Jul 06 2018

@devoncarew do you think this can be done.
Should this issue be moved to dart-lang/sdk to get the attention of the analyzer team?

@pq
Copy link
Contributor

pq commented Dec 7, 2018

/cc @scheglov

@stevemessick stevemessick added this to the On Deck milestone Dec 7, 2018
@scheglov
Copy link
Contributor

@branflake2267, I need your help to understand your feature request.

Do you prefer such code style, when list and map literals have explicit type annotations?
Or is there a lint that you enabled and that asks you to write these type annotations?

Because otherwise, if you don't need <String, WidgetBuilder>, there is very little for code completion to help you with. All you need is to type {} and start filling inside {}. I'm pretty sure that this would be faster than waiting for code completion.

@branflake2267
Copy link
Contributor

I figured it'd be nice to declare the generic types when and if auto-generating the snippet of code to fill in. That's because I like an explicit story when I read the code. But not everybody likes it verbose like that. I suspect you're right the brackets are the only thing needed, seems like that's the trend to have less noise...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants