Enable hovering function parameter inlay hints
This commit is contained in:
@@ -472,27 +472,30 @@ pub(crate) fn inlay_hint(
|
||||
| InlayKind::ClosingBraceHint => None,
|
||||
},
|
||||
text_edits: None,
|
||||
data: match inlay_hint.tooltip {
|
||||
data: (|| match inlay_hint.tooltip {
|
||||
Some(ide::InlayTooltip::HoverOffset(file_id, offset)) => {
|
||||
let uri = url(snap, file_id);
|
||||
let line_index = snap.file_line_index(file_id).ok()?;
|
||||
|
||||
let text_document = lsp_types::TextDocumentIdentifier { uri };
|
||||
to_value(lsp_ext::InlayHintResolveData {
|
||||
text_document,
|
||||
position: lsp_ext::PositionOrRange::Position(position(line_index, offset)),
|
||||
position: lsp_ext::PositionOrRange::Position(position(&line_index, offset)),
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
Some(ide::InlayTooltip::HoverRanged(file_id, text_range)) => {
|
||||
let uri = url(snap, file_id);
|
||||
let text_document = lsp_types::TextDocumentIdentifier { uri };
|
||||
let line_index = snap.file_line_index(file_id).ok()?;
|
||||
to_value(lsp_ext::InlayHintResolveData {
|
||||
text_document,
|
||||
position: lsp_ext::PositionOrRange::Range(range(line_index, text_range)),
|
||||
position: lsp_ext::PositionOrRange::Range(range(&line_index, text_range)),
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
})(),
|
||||
tooltip: Some(match inlay_hint.tooltip {
|
||||
Some(ide::InlayTooltip::String(s)) => lsp_types::InlayHintTooltip::String(s),
|
||||
_ => lsp_types::InlayHintTooltip::String(inlay_hint.label),
|
||||
|
||||
Reference in New Issue
Block a user