Skip to content

"wrap with widget" wraps the entire switch expression instead of the current branch #4758

@woprandi

Description

@woprandi

Describe the bug
"wrap with widget" wraps the entire switch expression instead of the current branch

To Reproduce

enum MyEnum {a, b}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return switch(get()) {
        MyEnum.a =>  const Text('a'),
        MyEnum.b =>  const Text('b'),
    };
  }
}

MyEnum get() {
// ...
}

Move your cursor to Text('a') and do a "Wrap with widget..." (or anything else)

Expected behavior
The new widget should be parent of the Text('a') branch and not of the entire switch expression

Screenshots
If applicable, add screenshots to help explain your problem.

Please complete the following information:

  • Operating System and version: Fedora 38
  • VS Code version: 1.82.2
  • Dart extension version: 3.72.2
  • Dart/Flutter SDK version: 3.1.2 / 3.13.5
  • 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