dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.05k stars 1.55k forks source link

Refactorings with non-fatal error, or warning statuses #53458

Open scheglov opened 12 months ago

scheglov commented 12 months ago

https://github.com/dart-lang/sdk/issues/53433

It would be nice to let users continue, even if some places cannot be updated.

@DanTup

DanTup commented 12 months ago

It looks like the current prompt we have is only for rename:

https://github.com/dart-lang/sdk/blob/06d644196a8b351f991b4baafe22bfc9223cd942/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart#L186-L194

I'll try adding support for this to refactors and see what it's like (I think we might have to show something like the first warnings text and "Refactor Anyway" as a button).

If that works well, then supporting updating some places would probably just be a case of making the refactor produce edits for the places it can do and an appropriate warning so the dialog explains that only some places are being updated.

bwilkerson commented 12 months ago

... we might have to show something like the first warnings text ...

How often do we have multiple warnings? I'm concerned about showing the user a warning they don't care about and not showing one they do care about.

scheglov commented 12 months ago

Multiple warnings? Easily, if you have several places with cascades. Can we show all warnings in a list?

DanTup commented 11 months ago

Can we show all warnings in a list?

We can't use any formatting in the toast notification, so while we could join them together they would all be merging into a single paragraph.

What we could possibly do is: