diff options
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r-- | crates/ide/src/hover.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 1c6d36939..c08516805 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -131,7 +131,7 @@ pub(crate) fn hover( | |||
131 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; | 131 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; |
132 | let (idl_range, link, ns) = | 132 | let (idl_range, link, ns) = |
133 | extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| { | 133 | extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| { |
134 | let InFile { file_id, value: range } = doc_mapping.map(range.clone())?; | 134 | let InFile { file_id, value: range } = doc_mapping.map(range)?; |
135 | if file_id == position.file_id.into() && range.contains(position.offset) { | 135 | if file_id == position.file_id.into() && range.contains(position.offset) { |
136 | Some((range, link, ns)) | 136 | Some((range, link, ns)) |
137 | } else { | 137 | } else { |
@@ -288,7 +288,7 @@ fn runnable_action( | |||
288 | ) -> Option<HoverAction> { | 288 | ) -> Option<HoverAction> { |
289 | match def { | 289 | match def { |
290 | Definition::ModuleDef(it) => match it { | 290 | Definition::ModuleDef(it) => match it { |
291 | ModuleDef::Module(it) => runnable_mod(&sema, it).map(|it| HoverAction::Runnable(it)), | 291 | ModuleDef::Module(it) => runnable_mod(sema, it).map(HoverAction::Runnable), |
292 | ModuleDef::Function(func) => { | 292 | ModuleDef::Function(func) => { |
293 | let src = func.source(sema.db)?; | 293 | let src = func.source(sema.db)?; |
294 | if src.file_id != file_id.into() { | 294 | if src.file_id != file_id.into() { |
@@ -297,7 +297,7 @@ fn runnable_action( | |||
297 | return None; | 297 | return None; |
298 | } | 298 | } |
299 | 299 | ||
300 | runnable_fn(&sema, func).map(HoverAction::Runnable) | 300 | runnable_fn(sema, func).map(HoverAction::Runnable) |
301 | } | 301 | } |
302 | _ => None, | 302 | _ => None, |
303 | }, | 303 | }, |
@@ -432,7 +432,7 @@ fn hover_for_definition( | |||
432 | return match def { | 432 | return match def { |
433 | Definition::Macro(it) => match &it.source(db)?.value { | 433 | Definition::Macro(it) => match &it.source(db)?.value { |
434 | Either::Left(mac) => { | 434 | Either::Left(mac) => { |
435 | let label = macro_label(&mac); | 435 | let label = macro_label(mac); |
436 | from_def_source_labeled(db, it, Some(label), mod_path) | 436 | from_def_source_labeled(db, it, Some(label), mod_path) |
437 | } | 437 | } |
438 | Either::Right(_) => { | 438 | Either::Right(_) => { |
@@ -516,7 +516,7 @@ fn hover_for_keyword( | |||
516 | if !token.kind().is_keyword() { | 516 | if !token.kind().is_keyword() { |
517 | return None; | 517 | return None; |
518 | } | 518 | } |
519 | let famous_defs = FamousDefs(&sema, sema.scope(&token.parent()?).krate()); | 519 | let famous_defs = FamousDefs(sema, sema.scope(&token.parent()?).krate()); |
520 | // std exposes {}_keyword modules with docstrings on the root to document keywords | 520 | // std exposes {}_keyword modules with docstrings on the root to document keywords |
521 | let keyword_mod = format!("{}_keyword", token.text()); | 521 | let keyword_mod = format!("{}_keyword", token.text()); |
522 | let doc_owner = find_std_module(&famous_defs, &keyword_mod)?; | 522 | let doc_owner = find_std_module(&famous_defs, &keyword_mod)?; |