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

Autocomplete not inserting parentheses or arguments for some items #2992

Closed
Merrit opened this issue Dec 7, 2020 · 5 comments
Closed

Autocomplete not inserting parentheses or arguments for some items #2992

Merrit opened this issue Dec 7, 2020 · 5 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Milestone

Comments

@Merrit
Copy link

Merrit commented Dec 7, 2020

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
@Merrit Merrit added the is bug label Dec 7, 2020
@DanTup DanTup added this to the v3.18.0 milestone Dec 7, 2020
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Dec 7, 2020
@DanTup
Copy link
Member

DanTup commented Dec 7, 2020

Thanks - tracked this down. We're not currently supported this for things that come via SuggestionSets. I'd actually accidentally fixed this while implementing something else, but that change is not ready to land yet, so I've extracted the fix t o its own change.

https://dart-review.googlesource.com/c/sdk/+/175251/

dart-bot pushed a commit to dart-lang/sdk that referenced this issue Dec 7, 2020
…tions

Fixes Dart-Code/Dart-Code#2992.

Change-Id: I95ee3735b7f10d9ad06c729c7b5e6aabeee005e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175251
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member

DanTup commented Dec 7, 2020

Fixed by dart-lang/sdk@2f2f9fc.

@DanTup DanTup closed this as completed Dec 7, 2020
@Merrit
Copy link
Author

Merrit commented Dec 7, 2020

Awesome!

Thank you for all your hard work Danny, very much appreciated 🎆

@kinex
Copy link

kinex commented Dec 8, 2020

I guess it is a related issue that parenthesis are not added for example to ChangeNotifier.notifyListeners()? This stopped working today after I upgraded Dart Code to the latest version (and enabled LSP).

So this will be fixed too by dart-lang/sdk@2f2f9fc? I guess it will take months before that will be available in Flutter stable, so are there any workarounds? I think this is quite an annoying issue, I already wrote some bugs due to this, see dart-lang/linter#2364.

@DanTup
Copy link
Member

DanTup commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Projects
None yet
Development

No branches or pull requests

3 participants