-
Notifications
You must be signed in to change notification settings - Fork 658
Show first line of the docs when hovering a component name #6609
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e5519c9
Ensure all generated files has the "DO NOT EDIT" warning
emilk 4eb5cbc
Add "DO NOT EDIT" warning to `component_defaults` file
emilk c9a2903
Rename and refactor
emilk 506d5da
Add helper `DataUi::data_ui_default`
emilk c6c840c
Sort component names by short name in UI
emilk 0af4735
Add DataUi for ComponentName
emilk 0017bfa
Add re_types_registry
emilk 01e49f2
Show component docs when hovering
emilk 069db9f
Replace `re_types_registry` with `re_viewer::reflection`
emilk 078040b
Rename and document `data_ui_default` -> `data_ui_recording`
emilk 8040cd1
Support docstrings in `quote!` blocks
emilk c5076d3
Move code from `api.rs` to `util.rs`
emilk b1dd878
Fix doclink
emilk d39e441
Top->down ordering
emilk e75d93c
Merge remote-tracking branch 'origin/main' into emilk/embedded-docs
Wumpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| use re_types_core::ComponentName; | ||
| use re_ui::UiExt as _; | ||
| use re_viewer_context::{UiLayout, ViewerContext}; | ||
|
|
||
| use super::DataUi; | ||
|
|
||
| impl DataUi for ComponentName { | ||
| fn data_ui( | ||
| &self, | ||
| _ctx: &ViewerContext<'_>, | ||
| ui: &mut egui::Ui, | ||
| ui_layout: UiLayout, | ||
| _query: &re_data_store::LatestAtQuery, | ||
| _db: &re_entity_db::EntityDb, | ||
| ) { | ||
| if ui_layout == UiLayout::List { | ||
| ui.label(self.full_name()); | ||
| } else { | ||
| ui.scope(|ui| { | ||
| ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend); | ||
| ui.label(format!("Full name: {}", self.full_name())); | ||
|
|
||
| // Only show the first line of the docs: | ||
| if let Some(markdown) = re_types_registry::components::registry() | ||
| .get(self) | ||
| .and_then(|info| info.docstring_md.lines().next()) | ||
| { | ||
| ui.markdown_ui(egui::Id::new(self), markdown); | ||
| } | ||
|
|
||
| if let Some(url) = self.doc_url() { | ||
| ui.re_hyperlink("Full documentation", url); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.