Skip to content

Add documentation of expected behaviour for code completion of functions (re: parameter placeholders) #3571

@nickmeinhold

Description

@nickmeinhold

Is your feature request related to a problem? Please describe.

I believe the expected behaviour for parameter completion is a bit inconsistent (presumably for good reasons), and it might be helpful to have some documentation to refer to.

To describe what I am seeing, if I make a class with two functions that have optional parameters (one named the other positional) and a pair of classes with constructors in the same pattern:

Screen Shot 2021-09-20 at 7 08 08 pm

For the function with optional positional parameters, the autocomplete gives one relevant option which adds placeholders for the parameters:

Screen Shot 2021-09-20 at 7 13 44 pm

Screen Shot 2021-09-20 at 7 13 53 pm

For the function with named positional parameters, the autocomplete gives one relevant option which does not add placeholders for the parameters:

Screen Shot 2021-09-20 at 7 17 47 pm

Screen Shot 2021-09-20 at 7 17 54 pm

In the case of constructor functions, two relevant options appear - with and without (...):

Screen Shot 2021-09-20 at 7 21 31 pm

Selecting the (...) option gives, in the case of optional named parameters, no placeholders:

Screen Shot 2021-09-20 at 7 21 42 pm

Whereas if I select the option without (...) I get just the class name:

Screen Shot 2021-09-20 at 9 54 34 pm

And if I then open the bracket, ie. hit '(' I get prompts for the parameters and a super helpful popover:

Screen Shot 2021-09-20 at 9 55 13 pm

The constructor function for optional positional parameters follows the same pattern:
Screen Shot 2021-09-20 at 10 01 42 pm
Screen Shot 2021-09-20 at 10 01 50 pm
Screen Shot 2021-09-20 at 10 02 19 pm

Describe the solution you'd like

The main thing that gets me is that I forget what to expect, eg. I select the (...) option in a constructor expecting placeholders because of the ... but get no placeholders and can't use Cmd . to get them and then can't remember if that's expected behaviour and have to go looking (which is all OK imo, but I figured it would be helpful if there were a reasonably obvious docs page that describes what to expect).

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    in docs / websiteRelates to documentation, including the Dart Code website

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions