Use a hash to find the correct inlay hint when resolving

This commit is contained in:
Lukas Wirth 2024-03-12 15:41:51 +01:00
parent 3115fd8b41
commit 4a93368590
7 changed files with 108 additions and 67 deletions

View file

@ -90,7 +90,7 @@ pub use crate::{
inlay_hints::{
AdjustmentHints, AdjustmentHintsMode, ClosureReturnTypeHints, DiscriminantHints,
InlayFieldsToResolve, InlayHint, InlayHintLabel, InlayHintLabelPart, InlayHintPosition,
InlayHintsConfig, InlayKind, InlayTooltip, LifetimeElisionHints, RangeLimit,
InlayHintsConfig, InlayKind, InlayTooltip, LifetimeElisionHints,
},
join_lines::JoinLinesConfig,
markup::Markup,
@ -415,10 +415,19 @@ impl Analysis {
&self,
config: &InlayHintsConfig,
file_id: FileId,
range: Option<RangeLimit>,
range: Option<TextRange>,
) -> Cancellable<Vec<InlayHint>> {
self.with_db(|db| inlay_hints::inlay_hints(db, file_id, range, config))
}
pub fn inlay_hints_resolve(
&self,
config: &InlayHintsConfig,
file_id: FileId,
position: TextSize,
hash: u64,
) -> Cancellable<Option<InlayHint>> {
self.with_db(|db| inlay_hints::inlay_hints_resolve(db, file_id, position, hash, config))
}
/// Returns the set of folding ranges.
pub fn folding_ranges(&self, file_id: FileId) -> Cancellable<Vec<Fold>> {