Skip to content

When nested folding ranges end on the same line, the outer range is incorrectly truncated #5750

@FMorschel

Description

@FMorschel

Describe the bug
Switch case folding doesn't fold until the next case if a function has parameters that span multiple lines (I think that is the issue, but maybe something similar at least?).

To Reproduce
Add a file with this sample:

Future<void> f() async {
  switch (1) {
    case 1:
      print('something');

      someBigFunctionName(
        someReallyReallyLongNameHereSoItHasToSplit: 1234567,
      );
    case 2:
      print('another thing');
      print('yet another thing');
    case 3:
      print('more things');
  }
}

void someBigFunctionName({
  int? someReallyReallyLongNameHereSoItHasToSplit,
}) {}

Try to fold at case 1 and see that it doesn't fold someBigFunctionName.

Expected behavior
It folds someBigFunctionName.

Please complete the following information:

Workspace Environment
Dart Code extension: 3.121.20250930
Flutter extension: 3.121.20250930 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.105.0

Workspace type: Dart (LSP)
Workspace name: bug

Dart (3.11.0-edge.1974c2360e1ee4345b9cb15929b1a2465559dc18): C:\Users\felip_0vh5fa6\dart
Flutter (3.35.5): C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter (No device)

Output from 'dart info'

C:\Users\felip_0vh5fa6\dart\bin\dart.exe info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.11.0-edge.1974c2360e1ee4345b9cb15929b1a2465559dc18 (main) (Mon Oct 6 18:46:13 2025 -0700) on "windows_x64"
  • on windows / "Windows 11 Pro" 10.0 (Build 26100)
  • locale is pt-BR

Project info

  • sdk constraint: '^3.9.0'
  • dependencies: analyzer, bloc, meta
  • dev_dependencies: lints, test, test_reflective_loader, very_good_analysis

Process info

Memory CPU Elapsed time Command line
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dartvm.exe
0 MB -- dartvm.exe
0 MB -- dartvm.exe
0 MB -- dartvm.exe
  • Operating System and version:
  • VS Code version:
  • Dart extension version:
  • Dart/Flutter SDK version:
  • Target device (if the issue relates to Flutter debugging):

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 bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions