Rollup merge of #58296 - estebank:hidden-suggestion, r=oli-obk
Hidden suggestion support Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding. r? @pietroalbini CC @zackmdavis
This commit is contained in:
commit
56e19160af
16 changed files with 245 additions and 69 deletions
|
@ -69,6 +69,29 @@ pub enum Applicability {
|
|||
Unspecified,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub enum SuggestionStyle {
|
||||
/// Hide the suggested code when displaying this suggestion inline.
|
||||
HideCodeInline,
|
||||
/// Always hide the suggested code but display the message.
|
||||
HideCodeAlways,
|
||||
/// Do not display this suggestion in the cli output, it is only meant for tools.
|
||||
CompletelyHidden,
|
||||
/// Always show the suggested code.
|
||||
/// This will *not* show the code if the suggestion is inline *and* the suggested code is
|
||||
/// empty.
|
||||
ShowCode,
|
||||
}
|
||||
|
||||
impl SuggestionStyle {
|
||||
fn hide_inline(&self) -> bool {
|
||||
match *self {
|
||||
SuggestionStyle::ShowCode => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub struct CodeSuggestion {
|
||||
/// Each substitute can have multiple variants due to multiple
|
||||
|
@ -94,7 +117,8 @@ pub struct CodeSuggestion {
|
|||
/// ```
|
||||
pub substitutions: Vec<Substitution>,
|
||||
pub msg: String,
|
||||
pub show_code_when_inline: bool,
|
||||
/// Visual representation of this suggestion.
|
||||
pub style: SuggestionStyle,
|
||||
/// Whether or not the suggestion is approximate
|
||||
///
|
||||
/// Sometimes we may show suggestions with placeholders,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue