lampepfl / scala3doc

16 stars 6 forks source link

Enhance diagram with full supertypes ancestry relationship, change arrowheads and add guards to avoid errors #218

Closed BarkingBad closed 3 years ago

BarkingBad commented 3 years ago

As I rewrited pretty much previous PR and some comments became irrelevant, I decided to close previous PR and open new one to get fresh view on changes. However, I'd like to address two issues that still remain valid:

  1. @abgruszecki, I assume your comment wanted me to try something like this: val parents = if smbl.exists then hackGetParents(classDef) else None instead of val parents = if smbl.exists then hackGetParents(smbl.tree.asInstanceOf[ClassDef]) else None, am I correct? I tried to shortened that, and suprisingly for me these lines are not equal. I cannot guarantee the first diagram with my first approach is correct, but the second one is certainly not (example for scala3doc/example/level2/Documentation)

Zrzut ekranu z 2020-10-23 18-06-10 Zrzut ekranu z 2020-10-23 18-07-50

  1. @TheElectronWill, you said that CSS should be changed. I was trying to represent background colours to much these from the old scaladoc. These colours were matched with white font, so I followed that convenction either. However, it is nice to have links that actually can be navigable embedded into diagram. It would be hard for user to distinguish which parts of diagram are links, and which one are plain text. Could you propose style that you see would fit best, so we can discuss it?
abgruszecki commented 3 years ago

@BarkingBad OK, I'm adding the issue with the ClassDef -> symbol -> tree route to the litany of issues we need to open in Dotty repo post-merge.

TheElectronWill commented 3 years ago

I was trying to represent background colours to much these from the old scaladoc. These colours were matched with white font, so I followed that convenction either. However, it is nice to have links that actually can be navigable embedded into diagram. It would be hard for user to distinguish which parts of diagram are links, and which one are plain text. Could you propose style that you see would fit best, so we can discuss it?

@BarkingBad I see two options:

  1. Keep the background colors, the white text, and simply underline resolved links like you did. Also add a "hint" on hover to confirm that "yes, this is a link":
    .diagram-class a:hover {
    color: #BFE7F3;
    }
  2. Use a white background, which allows links to be colored in blue like outside of the diagram.

I like the background colors, actually :slightly_smiling_face: They provide valuable and immediate information. Since it's quite intuitive that types in the diagram are clickable (when the link is resolved, at least), I think that underline+hint is enough. Therefore I would prefer option 1.

BarkingBad commented 3 years ago

Thank you for your response @TheElectronWill. I also like option 1, so I will add your CSS snippet