From 587897d186186b4b7c37e81f6e900c40d3f7f501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Vincent?= <28714795+leovct@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:37:26 +0100 Subject: [PATCH] fix(`forge doc`): display custom natspec tag (#9257) 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 4954cd7cdee18..bf2b0ad7b4f0d 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 d68f7a8e502c6..56a0a4026c504 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()?;