Support Multi-Case Switch Statements with the "Convert to switch expression" VScode code action #54567
Labels
analyzer-assist
Issues with analysis server assists
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
Note: I originally raised this issue in dart-code, and was directed to raise it here.
There's a neat code action to convert switch statements into expressions that take advantage of Dart 3's pattern matching:
Unfortunately, it does not work with switches with multiple cases giving the same return value:
It would be nice to be able to convert a multi-case switch like the following:
into:
I published a custom extension that supports this behavior, however, if it would be useful to enough people, it might be nice to have this behavior supported in the basic Dart VS code functionality.
The text was updated successfully, but these errors were encountered: