fix(bindings): omit wit // comments from generated Python docstrings - #251
cestercian wants to merge 1 commit into
Conversation
wit-parser folds both `//` comments and `///` docs into Docs. Strip ordinary WIT comments before the bindings command parses so generated docstrings keep only `///` and `/**` documentation. Fixes bytecodealliance#177 Co-authored-by: Cestercian <yashafaid@gmail.com>
|
Thanks, @cestercian. My initial thought is that we should update Specifically, I'd suggest splitting Token::Comment into e.g. |
|
@dicej agreed. preprocessor was a local workaround; splitting Token::Comment into DocComment / NonDocComment in wit-parser is the right place so wit-bindgen and the others get it too. i'll open a wasm-tools PR for that and park this componentize-py change until we can drop the filter (or thin it to just consume NonDocComment if the parser surfaces it). |
|
@dicej upstream PR opened: bytecodealliance/wasm-tools#2670 keeping this componentize-py PR as draft until that lands (or we can depend on a release that has the DocComment split). |
|
parking this for now — wasm-tools#2670 was closed; maintainers want a Component Model spec change for doc-comment syntax before wit-parser grows a DocComment token. will revisit once that lands (or if we should stick with the preprocessor approach here). |
Summary
The `bindings` command was putting both wit `//` comments and `///` docs into generated Python docstrings. Filter non-doc comments (`//` / `/* /`) before `wit-parser`, while keeping `///` and `/* */`.
Fixes #177
Test plan