-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDL Doc Field #1561
IDL Doc Field #1561
Conversation
hey @ebrightfield I would like to get this into the next release. Do you have time to finish this or do you want me to take over?
|
@paul-schaaf Awesome! I can knock it out tomorrow. To reiterate, action items are:
|
great!
yup! thanks! @ebrightfield |
@paul-schaaf just took care of everything, or nearly. Unsure how best to automate testing the Also, took the liberty of skipping over the |
On second thought, I think we don't need the feature. It seems like features are most useful if your code changes depending on whether your code would change depending on whether it's turned off or on. This isn't the case here, so I think that having a flag on the |
sounds good! |
Okay, feature removed. Any ideas on how best to automate test of Also, should |
yes that is what I meant by flag on
Manual testing is fine. Not critical if it doesn't work.
|
Okay, After merging, I created a dedicated program for testing under Edit: Got tests working. Should be good to go. |
what's the need for |
Ah, got it. Wasn't sure about that one. Just removed it from the publish command. |
…into idl_doc_field
lang/syn/src/lib.rs
Outdated
@@ -494,6 +499,8 @@ pub struct CompositeField { | |||
pub instruction_constraints: ConstraintGroup, | |||
pub symbol: String, | |||
pub raw_field: syn::Field, | |||
/// IDL Doc comment | |||
pub doc: Option<Vec<String>>, | |||
/// Documentation string. | |||
pub docs: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like there already has been code to parse docs before your PR that was saved in this docs
var. That code can be deleted now and the var too.
Although I think docs
is the more common name so it would make sense to me to use docs
everywhere instead of doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, renamed to docs
across the board (including no_doc
--> no_docs
where applicable.
Removal of the older docs
var caused a few compile errors in lang/syn/src/codegen/accounts/__*.rs
. Unsure how best to proceed on those. Appears to be formatting the string back into source code.
Edit: For now, I just decided to convert the is_empty
check to an if let Some(docs) = s.docs
, and construct the TokenStream
by iterating over the doc strings.
@ebrightfield is there anything else that youre about to push or can I merge now? |
I'm satisfied, go for it. |
thanks for the contribution! |
Adds a new, optional
doc
field to several of the IDL structs. The program module, instruction functions, and account structs are searched for inner doc comments (this is intended to minimize intrusion on existing programs, which likely use outer doc comments on those elements).IxArg
andIdlField
also will grab their associated doc comment.The
doc
field is not included in the IDL JSON in cases when it parses toNone
.Todo:
docs
field to theAccountField
, it just needs wiring up.doc
fields inanchor idl parse
.