diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-18 03:02:34 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-18 03:02:34 +0100 |
commit | e3d0d89d7e3e253234271008df9324ec1faf1746 (patch) | |
tree | 13c4972204ac32dd1a1702c254ffef4b85a76bf3 /crates/ide/src/lib.rs | |
parent | c04eaa1f37f31d7125372ba14da3d5059297e8b2 (diff) | |
parent | e0b01f34bb994ca8959f3040dbacafc6c56e4778 (diff) |
Merge #8345
8345: Add pub mod option for UnlinkedFile r=rainy-me a=rainy-me
close #8228
This is a draft that changes `Diagnostic` to contain multiple fixes. Pre analysis is in https://github.com/rust-analyzer/rust-analyzer/issues/8228#issuecomment-812887085 Because this solution is straightforward so I decided to type it out for discussion.
Currently the `check_fix` is not able to test the situation when multiple fixes available. <del>Also because `Insert 'mod x;'` and `Insert 'pub mod x;'` are so similar, I don't know how to test them correctly and want some suggestions.</del>. I added
`check_fixes` to allow checking mutiple possible fixes.
In additional, instead of append after possible existing `mod y`, I think it's possible to Insert `pub mod x;` after `pub mod y`. Should I implement this too?
Co-authored-by: rainy-me <[email protected]>
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index db08547d1..f4b90db3a 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -565,7 +565,7 @@ impl Analysis { | |||
565 | let diagnostic_assists = if include_fixes { | 565 | let diagnostic_assists = if include_fixes { |
566 | diagnostics::diagnostics(db, diagnostics_config, &resolve, frange.file_id) | 566 | diagnostics::diagnostics(db, diagnostics_config, &resolve, frange.file_id) |
567 | .into_iter() | 567 | .into_iter() |
568 | .filter_map(|it| it.fix) | 568 | .flat_map(|it| it.fixes.unwrap_or_default()) |
569 | .filter(|it| it.target.intersect(frange.range).is_some()) | 569 | .filter(|it| it.target.intersect(frange.range).is_some()) |
570 | .collect() | 570 | .collect() |
571 | } else { | 571 | } else { |