Skip to content

Commit

Permalink
added indentation for attrs
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <[email protected]>
  • Loading branch information
shruti2522 committed May 21, 2024
1 parent 2899043 commit 96ba645
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 @@ -47,6 +47,7 @@ pub(crate) fn hover(
// Use the api provided by GlobalState to get all attrs
let module_info = gs.get_packages().get_module_info(&kcl_pos.filename);
let schema_attrs = obj.get_all_attributes(gs.get_symbols(), module_info);
let mut attrs: Vec<String> = vec![];
for schema_attr in schema_attrs {
if let kclvm_sema::core::symbol::SymbolKind::Attribute =
schema_attr.get_kind()
Expand All @@ -59,14 +60,17 @@ pub(crate) fn hover(
Some(ty) => ty.ty_str(),
None => ANY_TYPE_STR.to_string(),
};
docs.push(format!(
"{}{}: {}",
attrs.push(format!(
"\t{}{}: {}",
name,
if attr_symbol.is_optional() { "?" } else { "" },
attr_ty_str,
));
}
}
if !attrs.is_empty() {
docs.push(attrs.join("\n"));
}
}
_ => {}
},
Expand Down

0 comments on commit 96ba645

Please sign in to comment.