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.

Autocomplete not inserting parentheses or arguments for some items

See original GitHub issue

Describe the bug Autocomplete seems to be working for some items, not for others.

So far I have tested these:

Working Not working
Custom functions print
.forEach widgets

So this is working as expected for something like a function I wrote myself, or myList.forEach(). Not sure why others aren’t working.

To Reproduce Steps to reproduce the behavior:

  1. In a function, eg main(), type prin
  2. Press Tab to accept ‘Print’ autocomplete

Expected behavior The item, eg print() or Text() should be completed with parentheses and arguments if appropriate.

Screenshots UdRW4b6cJu

9SWkoLOBev

Versions (please complete the following information):

  • VS Code version: 1.51.1
  • Dart extension version: 3.17.0
  • Dart/Flutter SDK version: Dart: 2.12.0-76.0.dev Flutter: 1.25.0-4.0.pre

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Dec 8, 2020

I guess it is a related issue that parenthesis are not added for example to ChangeNotifier.notifyListeners()?

If you’re on the Flutter stable channel, it seems likely. Support for dart.completeFunctionCalls is not yet available in Flutter’s stable channel.

So this will be fixed too by dart-lang/sdk@2f2f9fc?

I just tested it on a recent Flutter master and I’m getting parens accepting notifyListeners with dart.completeFunctionCalls enabled, so I believe it’s either fix by that change (or the previous one that first added the functionality).

are there any workarounds?

You could either switch back from LSP, or use a different Flutter channel. Unfortunately I don’t believe there are any other workarounds. The LSP functionality is not complete in current Flutter stable (this is the reason it’s still behind the preview flag). LSP won’t be made default until after these fixes all make the Flutter stable channel, though I’d encourage using LSP if there’s nothing breaking to you to help identify any remaining issues/gaps. If this is sufficiently annoying, I would recommend switching back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode add parentheses when autocompleting functions
It can be solved by ticking javascript.suggest.completeFunctionCalls property up.
Read more >
Use AutoComplete when entering formulas - Microsoft Support
AutoComplete helps you quickly insert functions and arguments while minimizing typing and syntax errors. The AutoComplete menu shows you available options ...
Read more >
Autoinserting parentheses even if the options are turned off
Uncheck "Automatically insert parentheses after completion " from Options > Intellisense > Completion Behavior, then begin annotating a class or method with an ......
Read more >
nvim-cmp and adding function brackets + arguments : r/neovim
My question is about cmp.mapping.confirm(), it works wonders for snippets but I'm missing something since it does not add function brackets and arguments....
Read more >
IntelliSense does not insert parentheses at the end of ...
For example I have some variable “list” of IList<T> type. When I type “list.” IntelliSense suggest a “Find” method, then I press Enter...
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