Skip to content

add function parameter names to generated docs #3410

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

Closed
andrewrk opened this issue Oct 8, 2019 · 2 comments
Closed

add function parameter names to generated docs #3410

andrewrk opened this issue Oct 8, 2019 · 2 comments
Labels
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Oct 8, 2019

std lib example: file:///home/andy/dev/zig/build/zig-cache/docs/index.html#std;io.readFileAlloc (I recognize this is a file:/// URL; we don't have #3402 done yet)

it shows:

fn readFileAlloc(*mem.Allocator, []const u8) ![]u8

but it should show:

fn readFileAlloc(allocator: *mem.Allocator, path: []const u8) ![]u8

I would also like to propose the following rule:

  • when a parameter name is its type name lower cased, the parameter name is omitted.

That would further adjust the expected docs to be:

fn readFileAlloc(*mem.Allocator, path: []const u8) ![]u8
@andrewrk andrewrk added the docs label Oct 8, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Oct 8, 2019
@ikskuh
Copy link
Contributor

ikskuh commented Oct 8, 2019

when a parameter name is its type name lower cased, the parameter name is omitted.

This is a great idea! Sometimes the type is documentation enough about how to use a certain parameter. Especially for something like *std.mem.Allocator the use in the Zig language is quite clear and thus removes clutter from the documentation.

@andrewrk
Copy link
Member Author

Thanks @FireFox317 for the implementation of this! I added the part about omitting parameter names that match the type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants