Detailed changes
@@ -3509,7 +3509,7 @@ impl AcpThreadView {
(method.id.0.clone(), method.name.clone())
};
- Button::new(SharedString::from(method_id.clone()), name)
+ Button::new(method_id.clone(), name)
.label_size(LabelSize::Small)
.map(|this| {
if ix == 0 {
@@ -838,7 +838,7 @@ impl AgentConfiguration {
.min_w_0()
.child(
h_flex()
- .id(SharedString::from(format!("tooltip-{}", item_id)))
+ .id(format!("tooltip-{}", item_id))
.h_full()
.w_3()
.mr_2()
@@ -87,7 +87,7 @@ impl ConfigureContextServerToolsModal {
v_flex()
.child(
h_flex()
- .id(SharedString::from(format!("tool-header-{}", index)))
+ .id(format!("tool-header-{}", index))
.py_1()
.pl_1()
.pr_2()
@@ -422,7 +422,7 @@ impl ManageProfilesModal {
let is_focused = profile.navigation.focus_handle.contains_focused(window, cx);
div()
- .id(SharedString::from(format!("profile-{}", profile.id)))
+ .id(format!("profile-{}", profile.id))
.track_focus(&profile.navigation.focus_handle)
.on_action({
let profile_id = profile.id.clone();
@@ -431,7 +431,7 @@ impl ManageProfilesModal {
})
})
.child(
- ListItem::new(SharedString::from(format!("profile-{}", profile.id)))
+ ListItem::new(format!("profile-{}", profile.id))
.toggle_state(is_focused)
.inset(true)
.spacing(ListItemSpacing::Sparse)
@@ -542,7 +542,7 @@ impl PickerDelegate for ProfilePickerDelegate {
let is_active = active_id == candidate.id;
Some(
- ListItem::new(SharedString::from(candidate.id.0.clone()))
+ ListItem::new(candidate.id.0.clone())
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -317,7 +317,7 @@ impl PickerDelegate for AttachModalDelegate {
let candidate = self.candidates.get(hit.candidate_id)?;
Some(
- ListItem::new(SharedString::from(format!("process-entry-{ix}")))
+ ListItem::new(format!("process-entry-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -327,7 +327,7 @@ impl PickerDelegate for AttachModalDelegate {
.child(Label::new(format!("{} {}", candidate.name, candidate.pid)))
.child(
div()
- .id(SharedString::from(format!("process-entry-{ix}-command")))
+ .id(format!("process-entry-{ix}-command"))
.tooltip(Tooltip::text(
candidate
.command
@@ -1519,7 +1519,7 @@ impl PickerDelegate for DebugDelegate {
});
Some(
- ListItem::new(SharedString::from(format!("debug-scenario-selection-{ix}")))
+ ListItem::new(format!("debug-scenario-selection-{ix}"))
.inset(true)
.start_slot::<IconWithIndicator>(icon)
.spacing(ListItemSpacing::Sparse)
@@ -286,10 +286,10 @@ impl Item for SubView {
impl Render for SubView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
v_flex()
- .id(SharedString::from(format!(
+ .id(format!(
"subview-container-{}",
self.kind.to_shared_string()
- )))
+ ))
.on_hover(cx.listener(|this, hovered, _, cx| {
this.hovered = *hovered;
cx.notify();
@@ -484,10 +484,7 @@ pub(crate) fn new_debugger_pane(
let deemphasized = !pane.has_focus(window, cx);
let item_ = item.boxed_clone();
div()
- .id(SharedString::from(format!(
- "debugger_tab_{}",
- item.item_id().as_u64()
- )))
+ .id(format!("debugger_tab_{}", item.item_id().as_u64()))
.p_1()
.rounded_md()
.cursor_pointer()
@@ -911,7 +911,7 @@ impl PickerDelegate for BranchListDelegate {
});
Some(
- ListItem::new(SharedString::from(format!("vcs-menu-{ix}")))
+ ListItem::new(format!("vcs-menu-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -220,7 +220,7 @@ impl PickerDelegate for PickerPromptDelegate {
let shortened_option = util::truncate_and_trailoff(&hit.string, self.max_match_length);
Some(
- ListItem::new(SharedString::from(format!("picker-prompt-menu-{ix}")))
+ ListItem::new(format!("picker-prompt-menu-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -464,7 +464,7 @@ impl PickerDelegate for StashListDelegate {
);
Some(
- ListItem::new(SharedString::from(format!("stash-{ix}")))
+ ListItem::new(format!("stash-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -665,7 +665,7 @@ impl PickerDelegate for WorktreeListDelegate {
};
Some(
- ListItem::new(SharedString::from(format!("worktree-menu-{ix}")))
+ ListItem::new(format!("worktree-menu-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -1,7 +1,7 @@
use gpui::{
Application, Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder,
- PathStyle, Pixels, Point, Render, SharedString, StrokeOptions, Window, WindowOptions, canvas,
- div, linear_color_stop, linear_gradient, point, prelude::*, px, quad, rgb, size,
+ PathStyle, Pixels, Point, Render, StrokeOptions, Window, WindowOptions, canvas, div,
+ linear_color_stop, linear_gradient, point, prelude::*, px, quad, rgb, size,
};
struct PaintingViewer {
@@ -309,7 +309,7 @@ fn button(
on_click: impl Fn(&mut PaintingViewer, &mut Context<PaintingViewer>) + 'static,
) -> impl IntoElement {
div()
- .id(SharedString::from(text.to_string()))
+ .id(text.to_string())
.child(text.to_string())
.bg(gpui::black())
.text_color(gpui::white())
@@ -1,6 +1,6 @@
use gpui::{
- App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, SharedString, Timer,
- Window, WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
+ App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Timer, Window,
+ WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
};
struct SubWindow {
@@ -9,7 +9,7 @@ struct SubWindow {
fn button(text: &str, on_click: impl Fn(&mut Window, &mut App) + 'static) -> impl IntoElement {
div()
- .id(SharedString::from(text.to_string()))
+ .id(text.to_string())
.flex_none()
.px_2()
.bg(rgb(0xf7f7f7))
@@ -5084,6 +5084,18 @@ impl From<SharedString> for ElementId {
}
}
+impl From<String> for ElementId {
+ fn from(name: String) -> Self {
+ ElementId::Name(name.into())
+ }
+}
+
+impl From<Arc<str>> for ElementId {
+ fn from(name: Arc<str>) -> Self {
+ ElementId::Name(name.into())
+ }
+}
+
impl From<Arc<std::path::Path>> for ElementId {
fn from(path: Arc<std::path::Path>) -> Self {
ElementId::Path(path)
@@ -378,7 +378,7 @@ impl Render for LivekitWindow {
.when_some(state.audio_output_stream.as_ref(), |el, state| {
el.child(
button()
- .id(SharedString::from(identity.0.clone()))
+ .id(identity.0.clone())
.child(if state.0.is_enabled() {
"Deafen"
} else {
@@ -5,8 +5,8 @@ use editor::Editor;
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
Action, AnyElement, App, AppContext as _, Context, DismissEvent, Entity, EventEmitter,
- Focusable, InteractiveElement, ParentElement, Render, SharedString, Styled, Subscription, Task,
- WeakEntity, Window, rems,
+ Focusable, InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity,
+ Window, rems,
};
use itertools::Itertools;
use picker::{Picker, PickerDelegate, highlighted_match_with_paths::HighlightedMatch};
@@ -526,7 +526,7 @@ impl PickerDelegate for TasksModalDelegate {
};
Some(
- ListItem::new(SharedString::from(format!("tasks-modal-{ix}")))
+ ListItem::new(format!("tasks-modal-{ix}"))
.inset(true)
.start_slot::<IconWithIndicator>(icon)
.end_slot::<AnyElement>(
@@ -151,10 +151,10 @@ impl ApplicationMenu {
// Application menu must have same ids as first menu item in standard menu
div()
- .id(SharedString::from(format!("{}-menu-item", menu_name)))
+ .id(format!("{}-menu-item", menu_name))
.occlude()
.child(
- PopoverMenu::new(SharedString::from(format!("{}-menu-popover", menu_name)))
+ PopoverMenu::new(format!("{}-menu-popover", menu_name))
.menu(move |window, cx| {
Self::build_menu_from_items(entry.clone(), window, cx).into()
})
@@ -184,10 +184,10 @@ impl ApplicationMenu {
.collect();
div()
- .id(SharedString::from(format!("{}-menu-item", menu_name)))
+ .id(format!("{}-menu-item", menu_name))
.occlude()
.child(
- PopoverMenu::new(SharedString::from(format!("{}-menu-popover", menu_name)))
+ PopoverMenu::new(format!("{}-menu-popover", menu_name))
.menu(move |window, cx| {
Self::build_menu_from_items(entry.clone(), window, cx).into()
})