Skip to content

Commit 1ff1419

Browse files
committed
fix hover function params render level
1 parent 6643902 commit 1ff1419

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

crates/emmylua_ls/src/handlers/hover/function/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,7 @@ fn hover_doc_function_type(
368368
if index == 0 && is_method && !func.is_colon_define() {
369369
"".to_string()
370370
} else if let Some(ty) = &param.1 {
371-
format!(
372-
"{}: {}",
373-
name,
374-
humanize_type(db, ty, builder.detail_render_level)
375-
)
371+
format!("{}: {}", name, humanize_type(db, ty, RenderLevel::Simple))
376372
} else {
377373
name.to_string()
378374
}

crates/emmylua_ls/src/handlers/test/hover_function_test.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ mod tests {
611611
M = {
612612
K = {}
613613
}
614-
M.K.Val<??>ue = function()
614+
M.K.<??>Value = function()
615615
end
616616
"#,
617617
VirtualHoverResult {
@@ -620,4 +620,28 @@ mod tests {
620620
));
621621
Ok(())
622622
}
623+
624+
#[gtest]
625+
fn test_fix_ref() -> Result<()> {
626+
let mut ws = ProviderVirtualWorkspace::new();
627+
ws.def(
628+
r#"
629+
---@class Player
630+
---@field name string
631+
632+
---@param player Player
633+
function CreatePlayer(player)
634+
end
635+
"#,
636+
);
637+
check!(ws.check_hover(
638+
r#"
639+
Creat<??>ePlayer({name = "John"})
640+
"#,
641+
VirtualHoverResult {
642+
value: "```lua\nfunction CreatePlayer(player: Player)\n```".to_string(),
643+
},
644+
));
645+
Ok(())
646+
}
623647
}

0 commit comments

Comments
 (0)