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.

Import quick-fix appears for `foo()` but not `foo`

See original GitHub issue

Dart Code 3.2.1 Mac OS

Hi, when I use quick fix on a function that doesn’t have it’s parentheses (or arguments, ie I’m specifying the function type rather making a call to a function), quick fix doesn’t suggest the function import statement for me. When the parentheses are added quick fix suggests the import.

Sometimes I pass functions around so the quick fix without the parentheses would be really useful.

doStuff(anotherFunction); // quick fix doesn't work
doStuff(anotherFunction()); // quick fix works

Would it be possible for the quick fix to work on the function without the parentheses?

Thank you

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
DanTupcommented, Aug 5, 2019

Fix is in https://github.com/dart-lang/sdk/commit/3011ca2da76d3dd0a6abed74750fe93d95bae17b. It may take a little time to make it to a Dart (or Flutter) stable release though.

1reaction
DanTupcommented, Aug 1, 2019

for some reason the code completion doesn’t always suggest the function

If you’ve only recently opened the project, there might be a delay before the completions for unimported symbols show up - but if you’re not seeing them at all even after a while, it’s worth opening another issue for.

Yes. Those two diagnostics have different codes associated with them

Aha - one is undefined_function and the other undefined_identifier. I don’t mind taking a look - I’m not very familiar with how the fixes work so it’s an opportunity to look through them even if it’s relatively straight forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quickfix does not add import to the existing line · Issue #19968 ...
try: import foo import bar as b from ctypes import c_int16, c_uint8 except ModuleNotFoundError as err: print(err) input('Press ENTER to leave').
Read more >
Why do circular imports seemingly work further up in the call ...
I think your answer comes down too hard on circular imports. Circularly imports usually work if you do just import foo rather than...
Read more >
"Add Import" quickfix disappears for an overload from another ...
Usual Add Import-suggestion (underlined text) shows on foo(42, 43, 44) call after re-analysis, but if not applied right away, disappears after any arbitrary ......
Read more >
attempted relative import with no known parent package - IQ-Inc
The functions are not imported directly into the script, but they are accessible via the module name. # foo.py def bar(): print("E-Flat walks ......
Read more >
475282 – Luna QuickFix does not insert first import statement into ...
List; public class Foo { Calendar calendar; List list; } =============== Eclipse correctly highlights error on a new line. Now QuickFix the calendar ......
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