Skip to content

Quick fix for "Add missing switch cases" does not add all quick fixes #5142

@navaronbracke

Description

@navaronbracke

Describe the bug
The quick fix for Add missing switch cases only adds one case at a time, instead of all of the missing cases.
I think this used to work before.

To Reproduce
Steps to reproduce the behavior:

  1. Use the given code sample
  2. Put the cursor on the switch keyword
  3. Open the assists / quick fixes menu in VSCode with the lightbulb
  4. Select Add missing switch cases
  5. Only one case is added, instead of all missing cases
void main() {
  final ResultType resultType = ResultType.done;

  switch (resultType) {}
}

enum ResultType { done, error, other }

Expected behavior
Since the quick fix indicates Add missing switch cases (note plural) I would expect the quick fix to add all of the missing ones.

Screenshots
Screenshot 2024-06-13 at 13 58 58

Screenshot 2024-06-13 at 13 59 09

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

App: Visual Studio Code
App Host: desktop
Version: mac 1.90.0

Workspace type: Flutter (LSP)

Dart (3.4.1): /Users/navaronbracke/Documents/flutter/bin/cache/dart-sdk
Flutter (3.22.1): /Users/navaronbracke/Documents/flutter (No device)

Output from 'dart info'

/Users/navaronbracke/Documents/flutter/bin/cache/dart-sdk/bin/dart 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.4.1 (stable) (Tue May 21 15:46:25 2024 +0000) on "macos_x64"
  • on macos / Version 14.4.1 (Build 23E224)
  • locale is en-BE

Project info

  • sdk constraint: '>=3.3.0 <4.0.0'
  • dependencies: android_id, app_settings, barcode, basic_utils, chewie, collection, connectivity_plus, device_info_plus, dio, dotted_border, file_picker, firebase_analytics, firebase_core, firebase_crashlytics, firebase_messaging, flutter, flutter_dotenv, flutter_email_sender, flutter_linkify, flutter_local_notifications, flutter_localizations, flutter_pdfview, flutter_riverpod, flutter_secure_storage, flutter_staggered_grid_view, flutter_svg, flutter_timezone, flutter_widget_from_html, fluttertoast, go_router, google_fonts, google_sign_in, html, image_picker, in_app_review, intl, jwt_decode, local_auth, local_auth_android, local_auth_darwin, maps_launcher, mime, mobile_scanner, open_file_plus, package_info_plus, path_provider, pin_code_fields, pointycastle, screen_brightness, sembast, sign_in_with_apple, skeleton_loader, slang, slang_flutter, timezone, url_launcher, url_strategy, wakelock_plus, web, workmanager
  • dev_dependencies: flutter_lints, flutter_test
  • elided dependencies: 1

Process info

Memory CPU Elapsed time Command line
20 MB 0.0% 02:49:21 dart devtools --machine --allow-embedding --dtd-uri ws:/DIShMweRdZRUFsyI
60 MB 0.0% 59:40 dart devtools --no-launch-browser
911 MB 0.3% 02:49:21 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.90.0
21 MB 0.0% 02:49:22 dart tooling-daemon --machine
80 MB 0.1% 02:49:22 flutter_tools.snapshot daemon
235 MB 0.7% 01:00:30 flutter_tools.snapshot run -d chrome
Output from 'flutter doctor'

/Users/navaronbracke/Documents/flutter/bin/flutter doctor -v

[✓] Flutter (Channel stable, 3.22.1, on macOS 14.4.1 23E224 darwin-x64, locale en-BE)
    • Flutter version 3.22.1 on channel stable at /Users/navaronbracke/Documents/flutter
    • Upstream repository git@github.com:navaronbracke/flutter.git
    • FLUTTER_GIT_URL = git@github.com:navaronbracke/flutter.git
    • Framework revision a14f74ff3a (3 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/navaronbracke/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/navaronbracke/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.90.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.4.1 23E224 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresis 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