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

Code completion for zero-argument functions should position the text cursor after the completion #3873

Closed
jamesderlin opened this issue Mar 15, 2022 · 2 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

@jamesderlin
Copy link

To Reproduce
Steps to reproduce the behavior:

  1. In VS Code, type: var s = 'HELLO WORLD'.toL. Completion suggests the .toLowerCase() method.
  2. Press Tab.

Result:
VS Code completes .toLowerCase() but positions the text cursor between the parentheses.

Expected behavior
Since the completed method is known to take zero arguments, positioning the text cursor between the parentheses seems pointless. I instead expected the text cursor to be after .toLowerCase(). After completion, I quickly typed ; and the Enter key before realizing what happened, and undoing the damage took additional effort.

I'm not sure if this is something that the Dart extension can do something about or if it's how code completion works in VS Code in general.

Versions (please complete the following information):

  • VS Code version: 1.65.1 on Linux x64
  • Dart extension version: 3.36.0
  • Dart/Flutter SDK version: 2.17.0
@DanTup DanTup added this to the v3.38.0 milestone Mar 15, 2022
@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 Mar 15, 2022
@DanTup
Copy link
Member

DanTup commented Mar 22, 2022

Yep, this comes from the LSP server. I've got a fix at https://dart-review.googlesource.com/c/sdk/+/238088/.

Since it's in the LSP Server, it'll show up in an SDK update rather than a VS Code extension update.

I'll close this once the change lands. Thanks!

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Mar 23, 2022
…s with 0 parameters

Fixes Dart-Code/Dart-Code#3873.

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

DanTup commented Mar 23, 2022

Fixed by dart-lang/sdk@13593b9.

@DanTup DanTup closed this as completed Mar 23, 2022
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

2 participants