Skip to content

Commit

Permalink
add condition for symbolkind in hover
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <[email protected]>
  • Loading branch information
shruti2522 committed Jun 2, 2024
1 parent 7d13577 commit 9cd0344
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kclvm/tools/src/LSP/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ pub(crate) fn hover(kcl_pos: &KCLPos, gs: &GlobalState) -> Option<lsp_types::Hov
_ => {}
}
}
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()),
Expand Down Expand Up @@ -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() {
Expand All @@ -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) => {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9cd0344

Please sign in to comment.