Skip to content

Code completing the value of a named argument doesn't show expected option: enum values #24759

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

Closed
sethladd opened this issue Oct 29, 2015 · 10 comments
Assignees
Labels
customer-flutter devexp-completion Issues with the analysis server's code completion feature legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sethladd
Copy link
Contributor

Here's the code in question:

import 'package:flutter/material.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessComponent {
  Widget build(BuildContext context) {
    return new Column([
      new Center(child: new Text("first")),
      new Center(child: new Text("second")),
      new Center(child: new Text("third"))
    ], justifyContent: );
  }
}

Put your cusor after justifyContent: and try to code complete.

Expected: Show me FlexJustifyContent. That's what justifyContent is annotated for.

Actual: a bunch of options, none of which make sense in this context.

screen shot 2015-10-29 at 2 53 36 pm

Hope that helps. Thanks!

@sethladd sethladd added Type-Defect legacy-area-analyzer Use area-devexp instead. devexp-completion Issues with the analysis server's code completion feature labels Oct 29, 2015
@sethladd
Copy link
Contributor Author

cc @devoncarew @danrubel

@sethladd
Copy link
Contributor Author

FWIW, if I start typing the correct type name (Flex...) I get all options that start with Flex, instead of the one option that really only works here.

screen shot 2015-10-29 at 2 57 50 pm

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@jwren jwren assigned jwren and unassigned danrubel Apr 11, 2016
@jwren
Copy link
Member

jwren commented Apr 11, 2016

Work in progress. PR to be uploaded soon.

@jwren
Copy link
Member

jwren commented Apr 12, 2016

https://codereview.chromium.org/1881733002/- gets us closer to having only the correct kind of thing suggested in some named argument list.

There is no such justifyContext any more. @sethladd what kind of annotation do you want respected? Is it Flutter specific? I don't think we have any such support in code completion yet.

@jwren
Copy link
Member

jwren commented Apr 26, 2016

@devoncarew Can you assist here? What kind of annotation was this before the API went away? Was it an enum, something else? Can you give me an example/sample that works with APIs today?

@devoncarew
Copy link
Member

@jwren, jup, looks like this code has changed. The new named parameter will be something like crossAxisAlignment:, and the valid values are CrossAxisAlignment enums (CrossAxisAlignment.start, end, center, stretch, baseline).

@devoncarew
Copy link
Member

So, the problem is mostly likely that named params that are enums don't suggest the enum values.

@sethladd
Copy link
Contributor Author

sethladd commented May 3, 2016

Sorry, I missed your ping.

That's what justifyContent is annotated for.

what kind of annotation do you want respected?

The type annotations on the parameters. In the example above, justifyContent has a type annotation for FlexJustifyContent. So, when trying to code complete a value for justifyContent, consider sorting/prioritizing FlexJustifyContent

Is it Flutter specific

Nope. Just a comment/suggestion around using Dart's type annotations.

@jwren jwren changed the title Code completing the value of a named argument doesn't show expected option Code completing the value of a named argument doesn't show expected option: enum values May 4, 2016
jwren added a commit that referenced this issue May 18, 2016
…also, filter out only the correct enum types in named arguments.

BUG=#24759

Review URL: https://codereview.chromium.org/1989393002 .
@sethladd
Copy link
Contributor Author

Looks like https://codereview.chromium.org/1989393002 was committed. Can we close this issue?

@jwren jwren closed this as completed Jan 28, 2017
@sethladd
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-flutter devexp-completion Issues with the analysis server's code completion feature legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants