docs: Fix minor docs issues (#1656)

Fixes #1643 by removing invalid docs
This commit is contained in:
Andreas Johansson 2025-11-21 10:34:30 +01:00 committed by GitHub
parent c91d806057
commit ffeeee5d12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 26 deletions

View file

@ -42,7 +42,8 @@ pub(crate) fn init(cx: &mut App) {
/// });
///
/// tree(&state, |ix, entry, selected, window, cx| {
/// div().px(px(16.) * entry.depth()).child(item.label.clone())
/// let item = entry.item();
/// ListItem::new(ix).pl(px(16.) * entry.depth()).child(item.label.clone())
/// })
/// ```
pub fn tree<R>(state: &Entity<TreeState>, render_item: R) -> Tree

View file

@ -24,7 +24,7 @@ use gpui::{actions, Action};
Context menus appear when right-clicking on an element:
```rust
use gpui_component::context_menu::ContextMenuExt;
use gpui_component::menu::ContextMenuExt;
div()
.child("Right click me")

View file

@ -454,5 +454,5 @@ Settings::new("app-settings")
[SettingItem]: https://docs.rs/gpui-component/latest/gpui_component/setting/struct.SettingItem.html
[SettingField]: https://docs.rs/gpui-component/latest/gpui_component/setting/enum.SettingField.html
[NumberFieldOptions]: https://docs.rs/gpui-component/latest/gpui_component/setting/struct.NumberFieldOptions.html
[GroupBox]: ./group_box.md
[GroupBox]: ./group-box.md
[Sizable]: https://docs.rs/gpui-component/latest/gpui_component/trait.Sizable.html

View file

@ -144,29 +144,6 @@ tree(&self.tree_state, {
})
```
### Tree with Context Menu
```rust
tree(&tree_state, |ix, entry, selected, window, cx| {
ListItem::new(ix)
.selected(selected)
.child(entry.item().label.clone())
.on_secondary_mouse_down(MouseButton::Right, {
let item = entry.item().clone();
move |_, _, cx| {
cx.show_context_menu(
ContextMenu::build(cx, |menu, cx| {
menu.action("Rename", Rename)
.action("Delete", Delete)
.separator()
.action("Copy Path", CopyPath)
})
);
}
})
})
```
### Disabled Items
```rust