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

Fix diagnostics on save or on format #12960

Open
HKalbasi opened this issue Aug 7, 2022 · 1 comment · May be fixed by #16715
Open

Fix diagnostics on save or on format #12960

HKalbasi opened this issue Aug 7, 2022 · 1 comment · May be fixed by #16715
Assignees
Labels
A-diagnostics diagnostics / error reporting C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now

Comments

@HKalbasi
Copy link
Member

HKalbasi commented Aug 7, 2022

There are some diagnostics which are safe to fix everywhere (like field-shorthand or useless-braces) and there are some diagnostics which you may not mean to fix some times, but even then, you can recover the previous state easily (unused-imports are in this category IMO, you can easily import removed things later with auto-import assist).

This issue suggests adding a list of diagnostics, empty by default, which allows r-a to fix them on save (or on format, or on another action, or configurable between them) automatically. We may still not fix all instances of diagnostics (for example, if user puts auto-import in that list, we may not fix those with multiple candidates). I think adding this config helps in development speed.

@lnicola lnicola added C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now labels Aug 7, 2022
@jonas-schievink jonas-schievink added the A-diagnostics diagnostics / error reporting label Aug 7, 2022
@Young-Flash
Copy link
Member

Young-Flash commented Feb 4, 2024

According to LSP CodeAction Request, when we request fix(or, CodeAction from LSP perspective) for diagnostic, we will get an array of CodeAction. That is, we can't get the corrsponding fix for a specifcy diagnostic

This issue suggests adding a list of diagnostics

So maybe it would better be a list of CodeAction('s title)? In this way we request the all the CodeActions for the current file, and then apply fixes which is in that list

@Young-Flash Young-Flash self-assigned this Feb 26, 2024
@Young-Flash Young-Flash linked a pull request Feb 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants