-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add an option to hide reborrows in adjustment inlay hints #20520
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,6 +226,14 @@ config_data! { | |
| inlayHints_discriminantHints_enable: DiscriminantHintsDef = | ||
| DiscriminantHintsDef::Never, | ||
|
|
||
| /// Disable reborrows in expression adjustments inlay hints. | ||
| /// | ||
| /// Reborrows are a pair of a builtin deref then borrow, i.e. `&*`. They are inserted by the compiler but are mostly useless to the programmer. | ||
| /// | ||
| /// Note: if the deref is not builtin (an overloaded deref), or the borrow is `&raw const`/`&raw mut`, they are not removed. | ||
| inlayHints_expressionAdjustmentHints_disableReborrows: bool = | ||
| true, | ||
|
|
||
| /// Show inlay hints for type adjustments. | ||
| inlayHints_expressionAdjustmentHints_enable: AdjustmentHintsDef = | ||
| AdjustmentHintsDef::Never, | ||
|
|
@@ -1888,12 +1896,14 @@ impl Config { | |
| AdjustmentHintsDef::Always => ide::AdjustmentHints::Always, | ||
| AdjustmentHintsDef::Never => match self.inlayHints_reborrowHints_enable() { | ||
| ReborrowHintsDef::Always | ReborrowHintsDef::Mutable => { | ||
| ide::AdjustmentHints::ReborrowOnly | ||
| ide::AdjustmentHints::BorrowsOnly | ||
| } | ||
| ReborrowHintsDef::Never => ide::AdjustmentHints::Never, | ||
| }, | ||
| AdjustmentHintsDef::Reborrow => ide::AdjustmentHints::ReborrowOnly, | ||
| AdjustmentHintsDef::Borrows => ide::AdjustmentHints::BorrowsOnly, | ||
| }, | ||
| adjustment_hints_disable_reborrows: *self | ||
| .inlayHints_expressionAdjustmentHints_disableReborrows(), | ||
| adjustment_hints_mode: match self.inlayHints_expressionAdjustmentHints_mode() { | ||
| AdjustmentHintsModeDef::Prefix => ide::AdjustmentHintsMode::Prefix, | ||
| AdjustmentHintsModeDef::Postfix => ide::AdjustmentHintsMode::Postfix, | ||
|
|
@@ -2822,7 +2832,8 @@ enum ReborrowHintsDef { | |
| #[derive(Serialize, Deserialize, Debug, Clone)] | ||
| #[serde(rename_all = "snake_case")] | ||
| enum AdjustmentHintsDef { | ||
| Reborrow, | ||
| #[serde(alias = "Reborrow")] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh maybe this must be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not. I even thought about that, but somehow still wrote |
||
| Borrows, | ||
| #[serde(with = "true_or_always")] | ||
| #[serde(untagged)] | ||
| Always, | ||
|
|
||
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.
note this breaks user configs using the old key
Uh oh!
There was an error while loading. Please reload this page.
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.
That's the inlay hints parameter, the real config has
#[serde(alias)]for this reason.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.
Hmm, I just used the pre-release and got an error about unrecognized config though