Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE Code Fixes available via Error Window. #29268

Closed
AdamSpeight2008 opened this issue Aug 14, 2018 · 5 comments
Closed

IDE Code Fixes available via Error Window. #29268

AdamSpeight2008 opened this issue Aug 14, 2018 · 5 comments
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Milestone

Comments

@AdamSpeight2008
Copy link
Contributor

It would be good to have code fixes available via the Error Window.
Eg Right Click in over and Error in the Error Window,
errorwindow_01
and have a sub menu Code Fixes -> Escape Keyword.

@markw-t
Copy link

markw-t commented Jun 1, 2022

To return to this discussion/item

Adding the following summary of a desired experience from David Pugh

It would be really nice if I could select a bunch of errors (RS0016 … not part of declared API) from the error list and attempt to quick fix them all.

The implementation would:

  1. Get the selected errors.
  2. For each error “navigate” to the file/line/column (ideally without moving the caret).
  3. Use the lightbulb APIs to find quick fixes available at that location.
  4. If the quick fix is applicable to the selected error code, apply the quick fix.

Steps 1 & 2 should be trivial, but I don’t know about 3 & 4 (including determining whether a particular quick fix is applicable to a specific error code). A clunky/slow solution (e.g. open/navigate to the location, use the quick fix tagger to determine the applicable fixes, iterate through the tags to find an appropriate fix, apply the fix) would be acceptable here. Even if processing 100 errors takes 10 minutes, it is still better than me performing 100 repetitive actions.

If 3 & 4 are doable with the current APIs, it should be possible to do this as an extension.

Experience thoughts
Thinking about design considerations:

  1. We could not have the "error list Lightbulbs" automatically move the doc view, but instead rely on showing previews in the existing lightbulb pop-outs or an expanded version of those. Instead they could show in the error list only.

  2. 1 above could also provide the means of previewing a proposed fix - since each error list line is a single locus of fix application and can provide it's own preview, we don’t need a multi-preview?

  3. Understanding which items have a fix - we could only offer lightbulbs for the cases when we are confident we can display a local fix, and display a LB icon in the error list for those?

@CyrusNajmabadi
Copy link
Member

It's up to the individual diagnostic if it supports 'fix all'. not part of declared API for example already supports fix-all for document/project/solution.

@sharwell
Copy link
Member

sharwell commented Jun 1, 2022

The approach from @markw-t would be difficult to present, since each diagnostic can have more than one applicable fix, and not all diagnostics have the same fix.

I would prefer an approach like this:

  1. Group the selected diagnostics by diagnostic ID.
  2. For each group (of one diagnostic ID), attempt to obtain the code fixes related to that diagnostic ID.
  3. Present the available code fixes to the user, and have them select one. Do not apply the fix yet.
  4. Repeat steps 2-3 until the each diagnostic ID is matched with the equivalence key for the expected fix.
  5. For each group, apply a "fix all in group" with the given equivalence key. This operation is performed in order until all groups are either fixed or no longer applicable

@markw-t
Copy link

markw-t commented Jun 1, 2022

@sharwell your approach definitely has some advantages - and as an added bonus, the error list already has the grouping features needed to make No1 happen. Would just need a way to surface the fixers per grouping as you imply at No3 . Or maybe it could be as simple as a right click to fix.

In my imagination my earlier approach was simply to use lightbulbs on each row as the preview opportunity, just inlining the preview one by one. But your way might be more efficient, at least reducing the "per diagnostic kind" load by grouping.

@CyrusNajmabadi
Copy link
Member

Closing out. This would need to be driven by platform if they want to support this.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
@dotnet dotnet locked and limited conversation to collaborators Oct 22, 2024
@CyrusNajmabadi CyrusNajmabadi moved this from Need Update to Complete in IDE: Design review Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area-IDE Feature Request Need Design Review The end user experience design needs to be reviewed and approved.
Projects
Status: Complete
Development

No branches or pull requests

5 participants