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

Completing a method/constructor name with no typed prefix inserts parenthesis even if already present #3672

Closed
caseyryan opened this issue Nov 16, 2021 · 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

@caseyryan
Copy link

caseyryan commented Nov 16, 2021

Describe the bug
v3.28.0 Places odd braces on autocompletion where there is already an existing pair

To Reproduce
Steps to reproduce the behavior:
Write some code like

Container(
  child: Padding(
    padding: EdgeInsets.all(8.0),
    child: Column(
      children: [
        
      ],
    ),
  ),
)
  1. erase "all" constructor name and type, e.g. symm
  2. When it prompts "symmetric" press enter to autocomplete it
  3. You will see odd pair of braces like this and the cursor between them
Container(
 child: Padding(
   padding: EdgeInsets.symmetric()(8.0),
   child: Column(
     children: [
       
     ],
   ),
 ),
)

Expected behavior
No braces added because there is already a pair of them right next to the prompted code
in this case with (8.0) inside

Screenshots

2021-11-16.19.04.55.mov

Versions (please complete the following information):

  • VS Code version: 1.62.2
  • Dart extension version: v3.28.0
  • Dart/Flutter SDK version: Dart 2.13.4 (stable), Flutter 2.2.3 (stable)
@DanTup DanTup added this to the v3.29.0 milestone Nov 16, 2021
@DanTup DanTup added the in editor Relates to code editing or language features label Nov 16, 2021
@DanTup
Copy link
Member

DanTup commented Nov 16, 2021

Thanks! This seems to be happen when there's no prefix already typed in the code:

ClassName.f^() // good
ClassName.^() // bad

The second expression is evaluated as a property named ( and the existing arglist detection didn't handle it. I've got a fix up for review at https://dart-review.googlesource.com/c/sdk/+/220380/.

@DanTup DanTup added the in lsp/analysis server Something to be fixed in the Dart analysis server label Nov 16, 2021
@DanTup DanTup changed the title Incorrect brace placing in v3.28.0 Completing a method/constructor name with no typed prefix inserts parenthesis even if already present Nov 16, 2021
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Nov 16, 2021
…without prefix

Fixes Dart-Code/Dart-Code#3672.

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

DanTup commented Nov 16, 2021

Fixed by dart-lang/sdk@327389b.

@DanTup DanTup closed this as completed Nov 16, 2021
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