Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r--crates/ide/src/hover.rs38
1 files changed, 21 insertions, 17 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index a48fe43e80..b0ef83e050 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -137,18 +137,20 @@ pub(crate) fn hover(
let edition =
sema.attach_first_edition(file_id).map(|it| it.edition(db)).unwrap_or(Edition::CURRENT);
let display_target = sema.first_crate(file_id)?.to_display_target(db);
- let mut res = if range.is_empty() {
- hover_offset(
- sema,
- FilePosition { file_id, offset: range.start() },
- file,
- config,
- edition,
- display_target,
- )
- } else {
- hover_ranged(sema, frange, file, config, edition, display_target)
- }?;
+ let mut res = salsa::attach(sema.db, || {
+ if range.is_empty() {
+ hover_offset(
+ sema,
+ FilePosition { file_id, offset: range.start() },
+ file,
+ config,
+ edition,
+ display_target,
+ )
+ } else {
+ hover_ranged(sema, frange, file, config, edition, display_target)
+ }
+ })?;
if let HoverDocFormat::PlainText = config.format {
res.info.markup = remove_markdown(res.info.markup.as_str()).into();
@@ -581,11 +583,13 @@ fn goto_type_action_for_def(
});
}
- if let Ok(generic_def) = GenericDef::try_from(def) {
- generic_def.type_or_const_params(db).into_iter().for_each(|it| {
- walk_and_push_ty(db, &it.ty(db), &mut push_new_def);
- });
- }
+ salsa::attach(db, || {
+ if let Ok(generic_def) = GenericDef::try_from(def) {
+ generic_def.type_or_const_params(db).into_iter().for_each(|it| {
+ walk_and_push_ty(db, &it.ty(db), &mut push_new_def);
+ });
+ }
+ });
let ty = match def {
Definition::Local(it) => Some(it.ty(db)),