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
Add pub mod option for UnlinkedFile #8345
Add pub mod option for UnlinkedFile #8345
Conversation
1cfe45f
to
a74e1fd
Compare
crates/ide/src/diagnostics/fixes.rs
Outdated
pub(crate) trait DiagnosticWithFix: Diagnostic { | ||
fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>; | ||
pub(crate) trait DiagnosticWithFixes: Diagnostic { | ||
fn fixes(&self, sema: &Semantics<RootDatabase>) -> Option<Vec<Fix>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an important invariant that the vector must be non-empty if this returns Some
? If not I think this should just return Vec<Fix>
without the option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I explained in #8345 (comment) as a second option, I think Vec<Fix>
(became Vec<Assist>
after rebasing) is better too. However functions inside fix
currently make extensive use of Try
trait and turning them to return Vec<Fix>
without Option
doesn't seem easy to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, I think it also makes sense to change it to return something like Option<HashMap<AssistId,Assist>>
which would possibly make it easier to test a specific Assist.
a74e1fd
to
735c37c
Compare
735c37c
to
bec89af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good to go, thanks!
bors d+
✌️ rainy-me can now approve this pull request. To approve and merge a pull request, simply reply with |
bec89af
to
6112376
Compare
6112376
to
e0b01f3
Compare
I resolved recent conflicts but think it's better to run the github workflow before r+? |
bors r+ |
close #8228
This is a draft that changes
Diagnostic
to contain multiple fixes. Pre analysis is in #8228 (comment) 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.Also because. I addedInsert 'mod x;'
andInsert 'pub mod x;'
are so similar, I don't know how to test them correctly and want some suggestions.check_fixes
to allow checking mutiple possible fixes.In additional, instead of append after possible existing
mod y
, I think it's possible to Insertpub mod x;
afterpub mod y
. Should I implement this too?