mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Remove hover inlay tooltips, replace them with location links
This commit is contained in:
parent
aafb0f1f8d
commit
60075a6625
15 changed files with 187 additions and 380 deletions
|
@ -10,7 +10,7 @@ use ide_db::{base_db::FileRange, RootDatabase};
|
|||
use stdx::to_lower_snake_case;
|
||||
use syntax::ast::{self, AstNode, HasArgList, HasName, UnaryOp};
|
||||
|
||||
use crate::{InlayHint, InlayHintsConfig, InlayKind, InlayTooltip};
|
||||
use crate::{InlayHint, InlayHintLabel, InlayHintsConfig, InlayKind};
|
||||
|
||||
pub(super) fn hints(
|
||||
acc: &mut Vec<InlayHint>,
|
||||
|
@ -43,12 +43,12 @@ pub(super) fn hints(
|
|||
!should_hide_param_name_hint(sema, &callable, param_name, arg)
|
||||
})
|
||||
.map(|(param, param_name, _, FileRange { range, .. })| {
|
||||
let mut tooltip = None;
|
||||
let mut linked_location = None;
|
||||
if let Some(name) = param {
|
||||
if let hir::CallableKind::Function(f) = callable.kind() {
|
||||
// assert the file is cached so we can map out of macros
|
||||
if let Some(_) = sema.source(f) {
|
||||
tooltip = sema.original_range_opt(name.syntax());
|
||||
linked_location = sema.original_range_opt(name.syntax());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,7 @@ pub(super) fn hints(
|
|||
InlayHint {
|
||||
range,
|
||||
kind: InlayKind::ParameterHint,
|
||||
label: param_name.into(),
|
||||
tooltip: tooltip.map(|it| InlayTooltip::HoverOffset(it.file_id, it.range.start())),
|
||||
label: InlayHintLabel::simple(param_name, None, linked_location),
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue