mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Restructure InlayHint, no longer derive properties from its kind
This commit is contained in:
parent
4c5fd19ee5
commit
730286b523
15 changed files with 417 additions and 349 deletions
|
@ -7,7 +7,7 @@ use ide_db::RootDatabase;
|
|||
|
||||
use syntax::ast::{self, AstNode};
|
||||
|
||||
use crate::{InlayHint, InlayHintsConfig, InlayKind};
|
||||
use crate::{InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind};
|
||||
|
||||
pub(super) fn hints(
|
||||
acc: &mut Vec<InlayHint>,
|
||||
|
@ -54,6 +54,9 @@ pub(super) fn hints(
|
|||
kind: InlayKind::BindingMode,
|
||||
label: r.to_string().into(),
|
||||
text_edit: None,
|
||||
position: InlayHintPosition::Before,
|
||||
pad_left: false,
|
||||
pad_right: mut_reference,
|
||||
});
|
||||
});
|
||||
match pat {
|
||||
|
@ -69,11 +72,20 @@ pub(super) fn hints(
|
|||
kind: InlayKind::BindingMode,
|
||||
label: bm.to_string().into(),
|
||||
text_edit: None,
|
||||
position: InlayHintPosition::Before,
|
||||
pad_left: false,
|
||||
pad_right: true,
|
||||
});
|
||||
}
|
||||
ast::Pat::OrPat(pat) if !pattern_adjustments.is_empty() && outer_paren_pat.is_none() => {
|
||||
acc.push(InlayHint::opening_paren(pat.syntax().text_range()));
|
||||
acc.push(InlayHint::closing_paren(pat.syntax().text_range()));
|
||||
acc.push(InlayHint::opening_paren_before(
|
||||
InlayKind::BindingMode,
|
||||
pat.syntax().text_range(),
|
||||
));
|
||||
acc.push(InlayHint::closing_paren_after(
|
||||
InlayKind::BindingMode,
|
||||
pat.syntax().text_range(),
|
||||
));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue