Skip to content

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

Closed

Description

@caseyryan

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)

Activity

  1. added this to the v3.29.0 milestone on Nov 16, 2021
  2. added
    in editorRelates to code editing or language features
    on Nov 16, 2021
  3. DanTup commented on Nov 16, 2021

    @DanTup
    Member

    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/.

  4. 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[/+] on Nov 16, 2021
  5. DanTup commented on Nov 16, 2021

    @DanTup
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions