question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Higher order functions always autocomplete to anonymous closures

See original GitHub issue

Seen 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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gaaclarkecommented, Aug 24, 2021
1reaction
DanTupcommented, Aug 13, 2021

@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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found