Skip to content

Commit

Permalink
Add signature getter for trait const and type item type (#6386)
Browse files Browse the repository at this point in the history
  • Loading branch information
wawel37 authored Sep 18, 2024
1 parent b974f0f commit 102b8f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/cairo-lang-doc/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use cairo_lang_filesystem::ids::{CrateId, FileId};
use cairo_lang_parser::utils::SimpleParserDatabase;
use cairo_lang_syntax::node::db::SyntaxGroup;
use cairo_lang_syntax::node::kind::SyntaxKind;
use cairo_lang_syntax::node::SyntaxNode;
use cairo_lang_utils::Upcast;
use itertools::{chain, Itertools};

Expand Down Expand Up @@ -132,6 +133,11 @@ fn get_item_signature(db: &dyn DocGroup, item_id: DocumentableItemId) -> String
.collect::<Vec<String>>()
.join("")
}
SyntaxKind::TraitItemConstant | SyntaxKind::TraitItemType => {
let children = db.get_children(syntax_node.clone());
let get_text = |node: &SyntaxNode| node.clone().get_text_without_trivia(db.upcast());
format!("{} {}", get_text(&children[1]), children[2..].iter().map(get_text).join(""))
}
_ => "".to_owned(),
};
fmt(definition)
Expand Down

0 comments on commit 102b8f0

Please sign in to comment.