Skip to content

Commit 0fced68

Browse files
committed
hint update
1 parent d8156ce commit 0fced68

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,6 @@ fn get_part(semantic_model: &SemanticModel, typ: &LuaType) -> Option<InlayHintLa
134134
location: get_type_location(semantic_model, typ, 0),
135135
..Default::default()
136136
}),
137-
LuaType::Ref(id) | LuaType::Def(id) => {
138-
let value = id.get_simple_name();
139-
let location = get_type_location(semantic_model, typ, 0);
140-
Some(InlayHintLabelPart {
141-
value: value.to_string(),
142-
location,
143-
..Default::default()
144-
})
145-
}
146137
_ => {
147138
let value = hint_humanize_type(semantic_model, typ, RenderLevel::Simple);
148139
let location = get_type_location(semantic_model, typ, 0);
@@ -206,24 +197,7 @@ fn get_base_type_location(semantic_model: &SemanticModel, name: &str) -> Option<
206197

207198
fn hint_humanize_type(semantic_model: &SemanticModel, typ: &LuaType, level: RenderLevel) -> String {
208199
match typ {
209-
LuaType::Ref(id) | LuaType::Def(id) => {
210-
let namespace = semantic_model
211-
.get_db()
212-
.get_type_index()
213-
.get_file_namespace(&semantic_model.get_file_id());
214-
if let Some(namespace) = namespace {
215-
// 如果 id 最前面是 namespace, 那么移除
216-
let id_name = id.get_name();
217-
let namespace_prefix = format!("{}.", namespace);
218-
if id_name.starts_with(&namespace_prefix) {
219-
id_name[namespace_prefix.len()..].to_string()
220-
} else {
221-
id_name.to_string()
222-
}
223-
} else {
224-
id.get_name().to_string()
225-
}
226-
}
200+
LuaType::Ref(id) | LuaType::Def(id) => id.get_simple_name().to_string(),
227201
LuaType::Generic(generic) => {
228202
let base_type_id = generic.get_base_type_id();
229203
let base_type_name =

0 commit comments

Comments
 (0)