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

Code completion should insert placeholders for @required parameters #553

Closed
mit-mit opened this issue Dec 15, 2016 · 12 comments
Closed

Code completion should insert placeholders for @required parameters #553

mit-mit opened this issue Dec 15, 2016 · 12 comments

Comments

@mit-mit
Copy link
Member

mit-mit commented Dec 15, 2016

Repro steps:

  1. Create a new Flutter project in IJ
  2. Delete new Text( 'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.', ) in line 80
  3. Type new Pad and complete to Padding

Expected result: Editor completes:

child:

to:

child: new Padding(
  padding: ,
),

thus making it clear that a padding argument is required.

Actual result: Editor completes to just new Padding()

@eseidelGoogle
Copy link

This feature sounds like a great carrot to encourage dart package authors (and flutter framework authors) to annotate @required correctly. :)

@devoncarew devoncarew modified the milestone: On Deck Jan 3, 2017
@devoncarew devoncarew assigned pq and unassigned stevemessick Feb 9, 2017
@devoncarew devoncarew modified the milestones: 0.1.11, On Deck Feb 14, 2017
@devoncarew
Copy link
Member

Not sure if there's an is an issue for the associated quick-fix for this -

pq added a commit to dart-lang/sdk that referenced this issue Feb 15, 2017
Groundwork for: flutter/flutter-intellij#553

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2692983003 .
@pq
Copy link
Contributor

pq commented Feb 19, 2017

Not sure if there's an is an issue for the associated quick-fix for this -

Quick-fixes landed last week.

screen shot 2017-02-19 at 10 59 34 am

🤘

Hope to dig into completions this week.

@pq
Copy link
Contributor

pq commented Feb 19, 2017

A little refinement to the proposal.

Instead of:

child: new Padding(
  padding: ,
),

I think we want:

child: new Padding(
  padding: null,
),

since it will parse cleanly.

@mit-mit
Copy link
Member Author

mit-mit commented Feb 20, 2017

That sounds right. And then the Flutter framework should be updated to mark child @required so that the expansion becomes:

   child: new Padding(
     padding: null,
     child: null,
   ),

pq added a commit to dart-lang/sdk that referenced this issue Feb 27, 2017
@mit-mit mit-mit modified the milestones: 0.1.12, 0.1.11 Feb 28, 2017
pq added a commit to dart-lang/sdk that referenced this issue Mar 1, 2017
First step towards wiring up default args for completions.

See: flutter/flutter-intellij#553

Next up: similar enhancements for type_members, imported_refs, etc.

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2722253002 .
pq added a commit to dart-lang/sdk that referenced this issue Mar 1, 2017
Default arg support for:
  * inherited refs
  * imported refs
  * type members
  * local constructors

BUG=
R=brianwilkerson@google.com, scheglov@google.com

See: flutter/flutter-intellij#553
Review-Url: https://codereview.chromium.org/2728653004 .
pq added a commit to pq/intellij-plugins that referenced this issue Mar 2, 2017
* updates to the latest version of the `CompletionSuggestion` API
* adds a template builder and linked edits for default argument lists (when present)

See: flutter/flutter-intellij#553
@pq
Copy link
Contributor

pq commented Mar 2, 2017

As of dart-lang/sdk@cc0036d, support is in place on the DAS side. Once JetBrains/intellij-plugins#495 lands, completions in IDEA will go from a proposal like this

screen shot 2017-03-02 at 1 13 05 pm

to generated code like this

screen shot 2017-03-02 at 1 13 17 pm

(Note that x, y and null are linked edits and you can TAB between them.)

FYI @sethladd

@sethladd
Copy link

sethladd commented Mar 2, 2017

Um, that's awesome. Nice work!

@mit-mit
Copy link
Member Author

mit-mit commented Mar 3, 2017 via email

@devoncarew
Copy link
Member

Very cool!

SergeyZh pushed a commit to JetBrains/intellij-plugins that referenced this issue Mar 7, 2017
* updates to the latest version of the `CompletionSuggestion` API
* adds a template builder and linked edits for default argument lists (when present)

See: flutter/flutter-intellij#553
@devoncarew devoncarew changed the title Completions should include placeholders for all @required parameters Code completion should insert placeholders for all @required parameters Mar 14, 2017
@devoncarew devoncarew changed the title Code completion should insert placeholders for all @required parameters Code completion should insert placeholders for @required parameters Mar 14, 2017
@devoncarew devoncarew mentioned this issue Mar 14, 2017
16 tasks
@pq
Copy link
Contributor

pq commented Mar 15, 2017

As of dart-lang/sdk@f33d072, completion on Padding looks like:

screen shot 2017-03-15 at 4 24 14 pm

👍

The relevant framework bits in IDEA landed in JetBrains/intellij-plugins@314c62a, and will be available in the next release of the Dart Plugin.

There's a continuing discussion of the treatment of non-required but possibly still desirable boiler-plate generation in #463.

Note that getting the required analysis bits into Flutter is gated by flutter/flutter#8812.

Since this is just gated by updates upstream, closing here.

@pq pq closed this as completed Mar 15, 2017
@sethladd
Copy link

Very cool!

SergeyZh pushed a commit to JetBrains/intellij-plugins that referenced this issue Mar 20, 2017
* updates to the latest version of the `CompletionSuggestion` API
* adds a template builder and linked edits for default argument lists (when present)

See: flutter/flutter-intellij#553
@tolotrasamuel
Copy link

@pq I have the latest Dart and Flutter plugin on Android studio but the code completion does not place cursor on null, it just sets it to null.

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

No branches or pull requests

7 participants