Skip to content

Commit a6b9294

Browse files
committed
fix double hover for function
1 parent 1f79513 commit a6b9294

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

crates/emmylua_ls/src/handlers/hover/build_hover.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn build_decl_hover(
8888
}
8989

9090
let property_owner = LuaPropertyOwnerId::LuaDecl(decl_id);
91-
add_description(db, &mut marked_strings, &typ, property_owner);
91+
add_description(db, &mut marked_strings, property_owner);
9292

9393
Some(Hover {
9494
contents: HoverContents::Array(marked_strings),
@@ -142,7 +142,6 @@ fn build_member_hover(
142142
add_description(
143143
db,
144144
&mut marked_strings,
145-
&typ,
146145
LuaPropertyOwnerId::Member(member_id),
147146
);
148147

@@ -155,23 +154,13 @@ fn build_member_hover(
155154
fn add_description(
156155
db: &DbIndex,
157156
marked_strings: &mut Vec<MarkedString>,
158-
typ: &LuaType,
159157
property_owner: LuaPropertyOwnerId,
160158
) {
161159
if let Some(property) = db.get_property_index().get_property(property_owner) {
162160
if let Some(detail) = &property.description {
163161
marked_strings.push(MarkedString::from_markdown(detail.to_string()));
164162
}
165163
}
166-
167-
if let LuaType::Signature(signature_id) = typ {
168-
let property_owner = LuaPropertyOwnerId::Signature(signature_id.clone());
169-
if let Some(property) = db.get_property_index().get_property(property_owner) {
170-
if let Some(detail) = &property.description {
171-
marked_strings.push(MarkedString::from_markdown(detail.to_string()));
172-
}
173-
}
174-
}
175164
}
176165

177166
fn build_type_decl_hover(
@@ -207,16 +196,16 @@ fn build_type_decl_hover(
207196
.get_property(property_owner)
208197
.and_then(|p| p.description.clone());
209198
if let Some(description) = description {
210-
s.push_str(&format!(" | {} --{}\n", type_humanize_text, description));
199+
s.push_str(&format!(
200+
" | {} --{}\n",
201+
type_humanize_text, description
202+
));
211203
} else {
212204
s.push_str(&format!(" | {}\n", type_humanize_text));
213205
}
214206
}
215207

216-
marked_strings.push(MarkedString::from_language_code(
217-
"lua".to_string(),
218-
s,
219-
));
208+
marked_strings.push(MarkedString::from_language_code("lua".to_string(), s));
220209
}
221210
} else if type_decl.is_enum() {
222211
marked_strings.push(MarkedString::from_language_code(
@@ -231,7 +220,7 @@ fn build_type_decl_hover(
231220
}
232221

233222
let property_owner = LuaPropertyOwnerId::TypeDecl(type_decl_id);
234-
add_description(db, &mut marked_strings, &typ, property_owner);
223+
add_description(db, &mut marked_strings, property_owner);
235224

236225
Some(Hover {
237226
contents: HoverContents::Array(marked_strings),

0 commit comments

Comments
 (0)