From 5248d8bd07f1f61e69aa5b8a297f4b8027ed2716 Mon Sep 17 00:00:00 2001 From: leovct Date: Mon, 4 Nov 2024 10:12:36 +0100 Subject: [PATCH] fix(forge doc): display custom natspec tag --- crates/doc/src/parser/comment.rs | 4 ++-- crates/doc/src/writer/as_doc.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/doc/src/parser/comment.rs b/crates/doc/src/parser/comment.rs index 4954cd7cdee1..bf2b0ad7b4f0 100644 --- a/crates/doc/src/parser/comment.rs +++ b/crates/doc/src/parser/comment.rs @@ -1,10 +1,10 @@ use alloy_primitives::map::HashMap; -use derive_more::{Deref, DerefMut}; +use derive_more::{derive::Display, Deref, DerefMut}; use solang_parser::doccomment::DocCommentTag; /// The natspec comment tag explaining the purpose of the comment. /// See: . -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Display, PartialEq, Eq)] pub enum CommentTag { /// A title that should describe the contract/interface Title, diff --git a/crates/doc/src/writer/as_doc.rs b/crates/doc/src/writer/as_doc.rs index d68f7a8e502c..56a0a4026c50 100644 --- a/crates/doc/src/writer/as_doc.rs +++ b/crates/doc/src/writer/as_doc.rs @@ -64,8 +64,9 @@ impl AsDoc for CommentsRef<'_> { writer.write_bold(&format!("Note{}:", if customs.len() == 1 { "" } else { "s" }))?; for c in customs.iter() { writer.writeln_raw(format!( - "{}{}", + "{}{}: {}", if customs.len() == 1 { "" } else { "- " }, + &c.tag, &c.value ))?; writer.writeln()?;