Skip to content

Unable to fold multiline method signatures and calls and other blocks #6008

@crtl

Description

@crtl

Code folding is not available for all code blocks that contain braces.
This include method signatures split over multiple lines

Steps to Reproduce

Using the following code in Android Studio you cannot fold the constructor to a single line.
These seems trivial in this simple example but when using something like freezed package constructors/factory can easily required more 10 or more arguments and the disability to fold these lines in editor is really annoying.
The same applies for method calls that are split over multiple lines.

class Test {
 final int first;
 final int second;

  Test({  // Unable to fold here
    this.first,
    this.second
   });
}

void testFn(List args) {
  
}

testFn([ // Unable to fold here
  1,
  2,
  3,
]);


// This enum is also not foldable
enum Status{

  @JsonValue("pending")
  pending,

  @JsonValue("voting")
  voting,

  @JsonValue("completed")
  completed,

  @JsonValue("failed")
  failed,
}

Version info

[✓] Flutter (Channel stable, 2.5.1, on Microsoft Windows [Version 10.0.19044.1526], locale en-DE)
    • Flutter version 2.5.1 at C:\Users\User\fvm\versions\2.5.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (6 months ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\User\AppData\Local\Android\sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\203.7784292\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[✓] Android Studio (version 2020.3)
    • Android Studio at C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\203.7935034
    • Flutter plugin version 65.0.1
    • Dart plugin version 203.8452
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Android Studio
    • Android Studio at C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\203.7784292
    • Flutter plugin version 62.0.1
    • Dart plugin version 203.8452
    • android-studio-dir = C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\203.7784292
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.64.2)
    • VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.34.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions