Skip to content

Commit 0159574

Browse files
committed
update param InlayHint
1 parent 204db21 commit 0159574

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/emmylua_ls/src/handlers/inlay_hint/build_inlay_hint.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use emmylua_parser::{
88
LuaAst, LuaAstNode, LuaCallExpr, LuaClosureExpr, LuaExpr, LuaFuncStat, LuaIndexExpr,
99
LuaLocalName, LuaSyntaxId, LuaVarExpr,
1010
};
11-
use lsp_types::{InlayHint, InlayHintKind, InlayHintLabel, InlayHintLabelPart};
11+
use lsp_types::{InlayHint, InlayHintKind, InlayHintLabel, InlayHintLabelPart, Location};
1212
use rowan::NodeOrToken;
1313

1414
use emmylua_code_analysis::humanize_type;
@@ -77,8 +77,12 @@ fn build_closure_hint(
7777
let lsp_range = document.to_lsp_range(lua_param.get_range())?;
7878
let typ_desc = format!(": {}", humanize_type(db, &typ, RenderLevel::Simple));
7979
let hint = InlayHint {
80-
kind: Some(InlayHintKind::PARAMETER),
81-
label: InlayHintLabel::String(typ_desc),
80+
kind: Some(InlayHintKind::TYPE),
81+
label: InlayHintLabel::LabelParts(vec![InlayHintLabelPart {
82+
value: typ_desc,
83+
location: Some(Location::new(document.get_uri(), lsp_range)),
84+
..Default::default()
85+
}]),
8286
position: lsp_range.end,
8387
text_edits: None,
8488
tooltip: None,

0 commit comments

Comments
 (0)