-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Add inheriting classes to DocTools
#77554
Conversation
DocData
DocTools
Order should be alphabetical, so global scopes go at the top and then everything else is in their case-independent alphanumerical order (natural, perhaps?). This is something that I've been working on, actually, when I stumbled upon your work :) So if you actually manage to address this issue here, that's an amazing improvement! |
Will change the ordering to natural, I think there's a helper already for it! Sounds great Bonus: unlike before new classes will end up in the right place in both search and the header of the help page, where before they were at the end Note that at least currently this is not true for searching without hierarchy, as it uses the order in |
d9e89b4
to
ec38a1e
Compare
We could use case sensitive natural sorting, but I think in this case this is sufficient, I'm not sure which order is preferred:
or:
|
I'd say the first one makes more sense when you search for something by the name. Either way, we can try and see if there are complaints. |
ec38a1e
to
e9b4801
Compare
I think this stage is ready for review properly now, and will continue to investigate the wider help indexing system as I am able |
Might solve #66407, will test Seems to still be an intermittent problem, will try investigate Edit: Does not solve it, seems to be caused by issues with the parser and circular references and don't think any implementation here can solve it, it appears to be that the |
e9b4801
to
7c5c354
Compare
7c5c354
to
33df4c3
Compare
Would you have a screenshot of the result? |
Will provide, for the correct order of sorted inherited classes? |
Well I'm not 100% sure what this PR changes but I'm assuming there's a before/after for the EditorHelp changes? |
This makes the hierarchy of inherited classes explicitly available in The direct benefit is avoiding scanning the entire class list in order to figure out inherited classes, and also a building block for handling the same Will provide screenshot for the sorting Edit: Forgot it also makes help search sorted alphabetically |
if ((cd.is_script_doc || ClassDB::class_exists(cd.name)) && doc->inheriting.has(cd.name)) { | ||
_push_normal_font(); | ||
for (const KeyValue<String, DocData::ClassDoc> &E : doc->class_list) { | ||
if (E.value.inherits == cd.name) { | ||
if (!found) { | ||
class_desc->push_color(theme_cache.title_color); | ||
class_desc->add_text(TTR("Inherited by:") + " "); | ||
found = true; | ||
} | ||
class_desc->push_color(theme_cache.title_color); | ||
class_desc->add_text(TTR("Inherited by:") + " "); | ||
|
||
if (prev) { | ||
class_desc->add_text(" , "); | ||
} | ||
_add_type_icon(E.value.name, theme_cache.doc_font_size, "ArrowRight"); | ||
class_desc->add_text(non_breaking_space); // Otherwise icon borrows hyperlink from _add_type(). | ||
_add_type(E.value.name); | ||
prev = true; | ||
for (RBSet<String, NaturalNoCaseComparator>::Element *itr = doc->inheriting[cd.name].front(); itr; itr = itr->next()) { | ||
if (itr->prev()) { | ||
class_desc->add_text(" , "); | ||
} | ||
|
||
_add_type_icon(itr->get(), theme_cache.doc_font_size, "ArrowRight"); | ||
class_desc->add_text(non_breaking_space); // Otherwise icon borrows hyperlink from _add_type(). | ||
_add_type(itr->get()); | ||
} | ||
_pop_normal_font(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the relevant change for that, which also avoids scanning the entire class list for all classes just to find inheriting ones
33df4c3
to
ea40ac2
Compare
80a7b38
to
ae34661
Compare
ae34661
to
17b848e
Compare
17b848e
to
62f2556
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, love the new ordered list very much!
Some minor notes remain, and I'm also not great with data structures, so maybe @KoBeWi could take a quick look. But overall it all seems sensible.
PS. We should improve at some point the relevance of what is selected as the closest match, I think. Typing "path" with "Display All", for example, selects the first complete match which is a property of a navigation server struct. Very unlikely to be relevant.
Will see about the relevance part in the final part, unsure how to improve it but good point! |
62f2556
to
dc86483
Compare
Thanks! |
Thank you! Great to have this one done with |
Integrating a documentation hierarchy into
DocTools
Part of the work for #77471 and #62524, see there for the discussions and background
Edit: I believe this is ready