aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ide/src/hover.rs21
-rw-r--r--crates/rust-analyzer/src/handlers.rs2
2 files changed, 12 insertions, 11 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index e9103ce59..c0786eb51 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -70,7 +70,7 @@ impl HoverConfig {
70#[derive(Debug, Clone)] 70#[derive(Debug, Clone)]
71pub enum HoverAction { 71pub enum HoverAction {
72 Runnable(Runnable), 72 Runnable(Runnable),
73 Implementaion(FilePosition), 73 Implementation(FilePosition),
74 GoToType(Vec<HoverGotoTypeData>), 74 GoToType(Vec<HoverGotoTypeData>),
75} 75}
76 76
@@ -116,12 +116,13 @@ pub(crate) fn hover(
116 }; 116 };
117 if let Some(definition) = definition { 117 if let Some(definition) = definition {
118 if let Some(markup) = hover_for_definition(db, definition) { 118 if let Some(markup) = hover_for_definition(db, definition) {
119 let markup = markup.as_str();
119 let markup = if !markdown { 120 let markup = if !markdown {
120 remove_markdown(&markup.as_str()) 121 remove_markdown(markup)
121 } else if links_in_hover { 122 } else if links_in_hover {
122 rewrite_links(db, &markup.as_str(), &definition) 123 rewrite_links(db, markup, &definition)
123 } else { 124 } else {
124 remove_links(&markup.as_str()) 125 remove_links(markup)
125 }; 126 };
126 res.markup = Markup::from(markup); 127 res.markup = Markup::from(markup);
127 if let Some(action) = show_implementations_action(db, definition) { 128 if let Some(action) = show_implementations_action(db, definition) {
@@ -175,7 +176,7 @@ pub(crate) fn hover(
175 176
176fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> { 177fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> {
177 fn to_action(nav_target: NavigationTarget) -> HoverAction { 178 fn to_action(nav_target: NavigationTarget) -> HoverAction {
178 HoverAction::Implementaion(FilePosition { 179 HoverAction::Implementation(FilePosition {
179 file_id: nav_target.file_id, 180 file_id: nav_target.file_id,
180 offset: nav_target.focus_or_full_range().start(), 181 offset: nav_target.focus_or_full_range().start(),
181 }) 182 })
@@ -1391,7 +1392,7 @@ fn bar() { fo<|>o(); }
1391 r"unsafe trait foo<|>() {}", 1392 r"unsafe trait foo<|>() {}",
1392 expect![[r#" 1393 expect![[r#"
1393 [ 1394 [
1394 Implementaion( 1395 Implementation(
1395 FilePosition { 1396 FilePosition {
1396 file_id: FileId( 1397 file_id: FileId(
1397 0, 1398 0,
@@ -2103,7 +2104,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2103 r#"trait foo<|>() {}"#, 2104 r#"trait foo<|>() {}"#,
2104 expect![[r#" 2105 expect![[r#"
2105 [ 2106 [
2106 Implementaion( 2107 Implementation(
2107 FilePosition { 2108 FilePosition {
2108 file_id: FileId( 2109 file_id: FileId(
2109 0, 2110 0,
@@ -2122,7 +2123,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2122 r"struct foo<|>() {}", 2123 r"struct foo<|>() {}",
2123 expect![[r#" 2124 expect![[r#"
2124 [ 2125 [
2125 Implementaion( 2126 Implementation(
2126 FilePosition { 2127 FilePosition {
2127 file_id: FileId( 2128 file_id: FileId(
2128 0, 2129 0,
@@ -2141,7 +2142,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2141 r#"union foo<|>() {}"#, 2142 r#"union foo<|>() {}"#,
2142 expect![[r#" 2143 expect![[r#"
2143 [ 2144 [
2144 Implementaion( 2145 Implementation(
2145 FilePosition { 2146 FilePosition {
2146 file_id: FileId( 2147 file_id: FileId(
2147 0, 2148 0,
@@ -2160,7 +2161,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2160 r"enum foo<|>() { A, B }", 2161 r"enum foo<|>() { A, B }",
2161 expect![[r#" 2162 expect![[r#"
2162 [ 2163 [
2163 Implementaion( 2164 Implementation(
2164 FilePosition { 2165 FilePosition {
2165 file_id: FileId( 2166 file_id: FileId(
2166 0, 2167 0,
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index dd486070b..c21ca044a 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -1648,7 +1648,7 @@ fn prepare_hover_actions(
1648 actions 1648 actions
1649 .iter() 1649 .iter()
1650 .filter_map(|it| match it { 1650 .filter_map(|it| match it {
1651 HoverAction::Implementaion(position) => show_impl_command_link(snap, position), 1651 HoverAction::Implementation(position) => show_impl_command_link(snap, position),
1652 HoverAction::Runnable(r) => runnable_action_links(snap, file_id, r.clone()), 1652 HoverAction::Runnable(r) => runnable_action_links(snap, file_id, r.clone()),
1653 HoverAction::GoToType(targets) => goto_type_action_links(snap, targets), 1653 HoverAction::GoToType(targets) => goto_type_action_links(snap, targets),
1654 }) 1654 })