refactor(oxlint/lsp): check for FixedContentKind instead of guessing logic#19795
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the fix_all_text_edit function in the LSP code actions module to use explicit type checking via FixedContentKind instead of relying on heuristics based on the length of the fixes array. This makes the code more maintainable and aligns it with the pattern already used in the apply_fix_code_actions function.
Changes:
- Replaced fragile length-based heuristic with explicit
FixedContentKindenum checking - Removed debug assertions that are no longer needed
- Used
.find()to locate the first real fix (LintRule or UnusedDirective) instead of.next().unwrap()
Merge activity
|
…g logic (#19795) > This PR refactors the `fix_all_text_edit` function in the LSP code actions module to use explicit type checking via `FixedContentKind` instead of relying on heuristics based on the length of the fixes array. This makes the code more maintainable and aligns it with the pattern already used in the `apply_fix_code_actions` function.
d8a6524 to
a45b9f4
Compare
ESLint shows by default suggestions in the editor. We did not have the right architecture to difference between safe or dangerous fix / suggestions. With #19113 we know now what kind of fix this is. This allows us now to align more with the ESLint editor experience. The last found tech dep was #19795. This will not apply for editors which manage its own configurations like VS Code editor and IntelliJ Plugin (cc @nrayburn-tech). These editors need their own default value changed. When using auto save `source.fixAll.oxc` or `source.fixAll` code action, or the `oxc.fixAll` command, the suggestions will be applied too. Because this is always in a context of one file only, I guess this is safe. Or we can change the line for this: https://github.com/oxc-project/oxc/blob/a45b9f4f808e4761ee615c31ea32bccfad322602/apps/oxlint/src/lsp/code_actions.rs#L96-L100

Uh oh!
There was an error while loading. Please reload this page.