Skip to content

Commit

Permalink
feat: update display for function name
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Aug 16, 2023
1 parent 8c58067 commit 522a450
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions counit-server/src/model/chapi_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub struct CodeFunction {
}

impl CodeFunction {
pub(crate) fn display(&self) -> String {
pub(crate) fn display(&self, class: &CodeDataStruct) -> String {
let annotation = self.annotations.iter()
.map(|it| {
let key_values = it.key_values.iter()
Expand Down Expand Up @@ -184,9 +184,12 @@ impl CodeFunction {
.collect::<Vec<String>>()
.join("\n");

let path = format!("path: {}", class.file_path);
let canonical_name = format!("canonical_name: {}.{}", class.package, class.node_name);

format!(
"{}\n{}({}) -> {} {{\n{}\n}}",
annotation, self.name, params, return_type, body
"{}\n{}\n{}\n{}({}) -> {} {{\n{}\n}}",
path, canonical_name, annotation, self.name, params, return_type, body
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion counit-server/src/server/archguard_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub async fn save_class_items(
let _ = &class.functions.iter().for_each(|method| {
tokio::task::block_in_place(|| {
Handle::current().block_on(async {
let display_text = &method.display();
let display_text = &method.display(class);
let origin_content = &method.content;

println!("class_items display_text {:?}", display_text);
Expand Down

0 comments on commit 522a450

Please sign in to comment.