@@ -48,7 +48,10 @@ pub fn build_closure_hint(
48
48
let mut label_parts = build_label_parts ( semantic_model, & typ) ;
49
49
// 为空时添加默认值
50
50
if label_parts. is_empty ( ) {
51
- let typ_desc = format ! ( ": {}" , hint_humanize_type( semantic_model, & typ) ) ;
51
+ let typ_desc = format ! (
52
+ ": {}" ,
53
+ hint_humanize_type( semantic_model, & typ, RenderLevel :: Simple )
54
+ ) ;
52
55
label_parts. push ( InlayHintLabelPart {
53
56
value : typ_desc,
54
57
location : Some (
@@ -134,7 +137,7 @@ fn get_part(semantic_model: &SemanticModel, typ: &LuaType) -> Option<InlayHintLa
134
137
} ) ;
135
138
}
136
139
_ => {
137
- let value = hint_humanize_type ( semantic_model, typ) ;
140
+ let value = hint_humanize_type ( semantic_model, typ, RenderLevel :: Simple ) ;
138
141
let location = get_type_location ( semantic_model, typ) ;
139
142
return Some ( InlayHintLabelPart {
140
143
value,
@@ -184,7 +187,7 @@ fn get_base_type_location(semantic_model: &SemanticModel, name: &str) -> Option<
184
187
Some ( Location :: new ( document. get_uri ( ) , lsp_range) )
185
188
}
186
189
187
- fn hint_humanize_type ( semantic_model : & SemanticModel , typ : & LuaType ) -> String {
190
+ fn hint_humanize_type ( semantic_model : & SemanticModel , typ : & LuaType , level : RenderLevel ) -> String {
188
191
match typ {
189
192
LuaType :: Ref ( id) | LuaType :: Def ( id) => {
190
193
let namespace = semantic_model
@@ -204,13 +207,17 @@ fn hint_humanize_type(semantic_model: &SemanticModel, typ: &LuaType) -> String {
204
207
id. get_name ( ) . to_string ( )
205
208
}
206
209
}
207
- LuaType :: Union ( union) => hint_humanize_union_type ( semantic_model, union) ,
208
- _ => humanize_type ( semantic_model. get_db ( ) , typ, RenderLevel :: Simple ) ,
210
+ LuaType :: Union ( union) => hint_humanize_union_type ( semantic_model, union, level ) ,
211
+ _ => humanize_type ( semantic_model. get_db ( ) , typ, level ) ,
209
212
}
210
213
}
211
214
212
- fn hint_humanize_union_type ( semantic_model : & SemanticModel , union : & LuaUnionType ) -> String {
213
- format_union_type ( union, RenderLevel :: Simple , |ty, _| {
214
- hint_humanize_type ( semantic_model, ty)
215
+ fn hint_humanize_union_type (
216
+ semantic_model : & SemanticModel ,
217
+ union : & LuaUnionType ,
218
+ level : RenderLevel ,
219
+ ) -> String {
220
+ format_union_type ( union, level, |ty, _| {
221
+ hint_humanize_type ( semantic_model, ty, level)
215
222
} )
216
223
}
0 commit comments