Skip to content
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

Parameter type information visually hard to find #121

Closed
DanielSank opened this issue Jul 26, 2016 · 6 comments
Closed

Parameter type information visually hard to find #121

DanielSank opened this issue Jul 26, 2016 · 6 comments

Comments

@DanielSank
Copy link

Consider the documentation found at (screenshot below) https://twistedmatrix.com/documents/current/api/twisted._threads.IWorker.html

At present, the type information is set off

  • By the string "type"
  • At the end of the parameter description
  • In parentheses

Parameter types are essential information. Consider

  • Putting the type a the beginning of the parameter description
  • Omitted the unnecessary word "type"
  • Giving the parameters their own colored box

pydoc_note

@mthuurne
Copy link
Contributor

mthuurne commented Mar 5, 2020

I agree that having the type in parentheses at the end is not great. I'm considering to either put the type immediately after the name, similar to PEP 484 annotations (task: Callable), or put it in a separate column.

Types can get quite long, for example the full PEP 484 syntax would be task: Callable[[], None] (a 0-argument callable that returns nothing). Type information becomes even longer when non-builtin types are used as type arguments, for example a list of workers would be List[twisted._threads.IWorker]. Therefore it might be better to have the documentation body on a separate line, below the name + type. It would then look like a definition list rather than a table.

@tristanlatr
Copy link
Contributor

I think the parameters types should be right after the param name, in the same "column", like https://geopy.readthedocs.io/en/stable/#nominatim

@tristanlatr
Copy link
Contributor

Therefore it might be better to have the documentation body on a separate line, below the name + type. It would then look like a definition list rather than a table.

This is not exactly what I did, I stuck with the common way to show arguments types: In parenthesis on the same column as the arg name.
I fix the size of the argument name column to 25%.
To handle the longer type names, I've add potential line breaks after [ or , in type rendering:
by default 2021-01-14 at 10 33 28 AM

@tristanlatr
Copy link
Contributor

after second try, it looks like this (on a small screen):

Capture d’écran, le 2021-01-30 à 11 14 43

@mthuurne
Copy link
Contributor

mthuurne commented Feb 3, 2021

I think that latest version is a big improvement over the current implementation.

The font baseline isn't aligned at the moment: the type names are a few pixels lower than the parameter names. There is probably something that could be done in CSS to fix that.

If the type cell is inside a flex layout (I think I read that in a commit title), maybe enable wrapping? That way, instead of

fields: Sequence[
        Field]

we would have

fields:
Sequence[Field]

@tristanlatr
Copy link
Contributor

Yep I did do that after: only for screens smaller than 650px ,
Please see the changes here: https://pydoctor--299.org.readthedocs.build/en/299/api/pydoctor.epydoc2stan.html

I'll merge the master and mark the PR as ready in a few

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

No branches or pull requests

3 participants