diff --git a/kclvm/tools/src/LSP/src/hover.rs b/kclvm/tools/src/LSP/src/hover.rs index 066562a45..d0a5257dd 100644 --- a/kclvm/tools/src/LSP/src/hover.rs +++ b/kclvm/tools/src/LSP/src/hover.rs @@ -92,14 +92,14 @@ pub(crate) fn hover(kcl_pos: &KCLPos, gs: &GlobalState) -> Option {} } } - kclvm_sema::core::symbol::SymbolKind::Function => match &obj.get_sema_info().ty { + kclvm_sema::core::symbol::SymbolKind::Value | kclvm_sema::core::symbol::SymbolKind::Function => match &obj.get_sema_info().ty { Some(ty) => match &ty.kind { kclvm_sema::ty::TypeKind::Function(func_ty) => { docs.append(&mut build_func_hover_content( func_ty.clone(), obj.get_name().clone(), )); - } + } _ => { docs.push(( format!("{}: {}", &obj.get_name(), ty.ty_str()), @@ -424,6 +424,8 @@ mod tests { }; let got = hover(&pos, &gs).unwrap(); + println!("{:?}", got); + match got.contents { lsp_types::HoverContents::Array(vec) => { if let MarkedString::LanguageString(s) = vec[0].clone() { @@ -448,6 +450,7 @@ mod tests { column: Some(18), }; let got = hover(&pos, &gs).unwrap(); + println!("{:?}", got); match got.contents { lsp_types::HoverContents::Array(vec) => { @@ -559,6 +562,7 @@ mod tests { column: Some(12), }; let got = hover(&pos, &gs).unwrap(); + println!("{:?}", got); match got.contents { lsp_types::HoverContents::Array(vec) => { assert_eq!(vec.len(), 3);