mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Merge pull request #20445 from rust-lang/veykril/push-twmmuyzwtxno
fix: Attach db for inlay hint compute
This commit is contained in:
commit
2cc7bb371d
@ -289,7 +289,7 @@ impl<'db> DbInterner<'db> {
|
|||||||
krate: None,
|
krate: None,
|
||||||
block: None,
|
block: None,
|
||||||
})
|
})
|
||||||
.unwrap()
|
.expect("db is expected to be attached")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with(
|
pub fn new_with(
|
||||||
|
@ -107,14 +107,16 @@ pub(crate) fn inlay_hints(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut preorder = file.preorder();
|
let mut preorder = file.preorder();
|
||||||
while let Some(event) = preorder.next() {
|
salsa::attach(sema.db, || {
|
||||||
if matches!((&event, range_limit), (WalkEvent::Enter(node), Some(range)) if range.intersect(node.text_range()).is_none())
|
while let Some(event) = preorder.next() {
|
||||||
{
|
if matches!((&event, range_limit), (WalkEvent::Enter(node), Some(range)) if range.intersect(node.text_range()).is_none())
|
||||||
preorder.skip_subtree();
|
{
|
||||||
continue;
|
preorder.skip_subtree();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
hints(event);
|
||||||
}
|
}
|
||||||
hints(event);
|
});
|
||||||
}
|
|
||||||
if let Some(range_limit) = range_limit {
|
if let Some(range_limit) = range_limit {
|
||||||
acc.retain(|hint| range_limit.contains_range(hint.range));
|
acc.retain(|hint| range_limit.contains_range(hint.range));
|
||||||
}
|
}
|
||||||
@ -736,7 +738,7 @@ fn label_of_ty(
|
|||||||
config: &InlayHintsConfig,
|
config: &InlayHintsConfig,
|
||||||
display_target: DisplayTarget,
|
display_target: DisplayTarget,
|
||||||
) -> Result<(), HirDisplayError> {
|
) -> Result<(), HirDisplayError> {
|
||||||
let iter_item_type = salsa::attach(sema.db, || hint_iterator(sema, famous_defs, ty));
|
let iter_item_type = hint_iterator(sema, famous_defs, ty);
|
||||||
match iter_item_type {
|
match iter_item_type {
|
||||||
Some((iter_trait, item, ty)) => {
|
Some((iter_trait, item, ty)) => {
|
||||||
const LABEL_START: &str = "impl ";
|
const LABEL_START: &str = "impl ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user