Open FMorschel opened 2 months ago
Summary: The "Remove break (single)" assist in the Dart editor provides little benefit for removing a single break statement. The user suggests removing this assist from the list of available options as it offers minimal value.
@bwilkerson any precedent for this? Only offering a fix as an "across file" fix, and not in an individual position?
I can't think of any other fixes that can only be applied across the whole file and not in a single location.
If we really believe that there's no value in applying it individually then I could see an argument for not including the option in the menu (to reduce clutter), but there's also an argument to be made for consistency. Not sure which is the stronger design principle in this case.
However, the current implementation will only present a whole-file fix if there's more than one diagnostic in the file. Unless we change that behavior I believe that the suggested change will have the effect of removing the fix in the case where there's only one such diagnostic being reported in a file. I don't think that would be a good idea. (I haven't looked at the CL, so it's possible that concern has already been dealt with.)
Reading your answer and the current implementation (and check failure) of the CL, I don't think the approach I took was the correct one.
What if we added a new CorrectionApplicability
option or new propriety in ResolvedCorrectionProducer
to indicate that "if there is more than one, show only the multi fix"? I think this would be a better solution to this. WDYT?
I agree that adding an applicability of "if there is more than one, show only the multi fix" would be a better approach. The only question in my mind is whether the value is greater than the cost (of both implementation and of maintenance).
Consider removing the
Remove break
(single) assist from the list.There is little to no (I could not find any) gain in removing a single break statement. I'm not sure if there are any other lints that we should consider doing the same treatment. Where there would be few to no gains in leaving the single-fix option in the list.
Inspired by https://github.com/dart-lang/sdk/issues/56371.