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. |
| /// IDL Doc comment | ||
| pub doc: Option<Vec<String>>, | ||
| /// Documentation string. | ||
| pub docs: String, |
There was a problem hiding this comment.
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.
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
docfield 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).IxArgandIdlFieldalso will grab their associated doc comment.The
docfield is not included in the IDL JSON in cases when it parses toNone.Todo:
docsfield to theAccountField, it just needs wiring up.docfields inanchor idl parse.