Higher order functions always autocomplete to anonymous closures
See original GitHub issueSeen behavior:
Given the following code:
String _commaJoin(String x, String y) => '$x, $y';
void foo() {
final List<String> bar = <String>['Hello', 'world'];
bar.re**CURSOR HERE**
}
If I select ‘reduce()’ from the suggestions it will autocomplete bar.reduce((value, element) => null)
highlighting null
.
What I expected
What I actually wanted was bar.reduce(_commaJoin)
. It’s a bit of a hassle to delete the closure. In this case no autocomplete of the argument would be better, or a dropdown list of functions in the current context that match the needed signature like so:
┌─────────────┐
│ Lambda │
│ _commaJoin │
└─────────────┘
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Higher order functions always autocomplete to anonymous ...
If I select 'reduce()' from the suggestions it will autocomplete bar.reduce((value, element) => null) highlighting null .
Read more >Higher Order Functions. Closures, function factories, common…
A functions closure is a pointer, that the function carries with it. It points to a table of all the variables in the...
Read more >Closures, first-class functions and higher-order functions
The anonymous function doesn't get executed here, only returned. myClosure is a higher-order function. When myClosure then gets executed the return value is ......
Read more >Higher Order Functions - Learn You Some Erlang
Higher order functions : how to pass functions as parameters to other functions ... anonymous functions (funs), understanding scopes and the concept of...
Read more >Allowing the object.method(args...) syntax as an alias for method ...
Better yet, we could use ↦ ( \mapsto<tab> ) for anonymous function ... We have lots of higher-order functions too, where the “verbs”...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Filed at https://github.com/dart-lang/sdk/issues/46979
@gaaclarke just copying the above is fine, those triaging issues in the Dart repo will know what to do with it - though feel free to post the link back here (@bwilkerson who commented above is on the Dart Team and works on the analyzer).
And FWIW it’s certainly not an issue to raise issues here first if you’re unsure where they belong - there’s a fairly blurry line between what comes from server/extension, and for some smaller (or LSP) issues I’ll work on fixes too. Thanks!