settings_ui: Add pickers for theme and icon themes (#40829)
In the process of adding pickers for the theme and icon themes fields in the settings UI, I felt like there was an improvement opportunity in regards to where some of these components are stored. The `ui_input` crate originally was meant only for the text field-like component, which couldn't be in the regular `ui` crate due to the dependency with `editor`. Given we had also added the number field there—which is similar in also having the same dependency—it made sense to think of this crate more like a home for form-like components rather than for only one component. However, we were also storing some settings UI-specific stuff in that crate, which didn't feel right. So I ended up creating a new directory within the `settings_ui` for components and moved all the pickers and the custom input field there. I think this makes it for a cleaner structure. Release Notes: - settings_ui: Added the ability to search for theme and icon themes in their respective fields.
This commit is contained in:
@@ -17,7 +17,7 @@ use language::{Buffer, DiskState};
|
||||
use ordered_float::OrderedFloat;
|
||||
use project::{Project, WorktreeId, telemetry_snapshot::TelemetrySnapshot};
|
||||
use ui::{ButtonLike, ContextMenu, ContextMenuEntry, DropdownMenu, KeyBinding, prelude::*};
|
||||
use ui_input::SingleLineInput;
|
||||
use ui_input::InputField;
|
||||
use util::{ResultExt, paths::PathStyle, rel_path::RelPath};
|
||||
use workspace::{Item, SplitDirection, Workspace};
|
||||
use zeta2::{PredictionDebugInfo, Zeta, Zeta2FeatureFlag, ZetaOptions};
|
||||
@@ -65,11 +65,11 @@ pub struct Zeta2Inspector {
|
||||
focus_handle: FocusHandle,
|
||||
project: Entity<Project>,
|
||||
last_prediction: Option<LastPrediction>,
|
||||
max_excerpt_bytes_input: Entity<SingleLineInput>,
|
||||
min_excerpt_bytes_input: Entity<SingleLineInput>,
|
||||
cursor_context_ratio_input: Entity<SingleLineInput>,
|
||||
max_prompt_bytes_input: Entity<SingleLineInput>,
|
||||
max_retrieved_declarations: Entity<SingleLineInput>,
|
||||
max_excerpt_bytes_input: Entity<InputField>,
|
||||
min_excerpt_bytes_input: Entity<InputField>,
|
||||
cursor_context_ratio_input: Entity<InputField>,
|
||||
max_prompt_bytes_input: Entity<InputField>,
|
||||
max_retrieved_declarations: Entity<InputField>,
|
||||
active_view: ActiveView,
|
||||
zeta: Entity<Zeta>,
|
||||
_active_editor_subscription: Option<Subscription>,
|
||||
@@ -225,9 +225,9 @@ impl Zeta2Inspector {
|
||||
label: &'static str,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Entity<SingleLineInput> {
|
||||
) -> Entity<InputField> {
|
||||
let input = cx.new(|cx| {
|
||||
SingleLineInput::new(window, cx, "")
|
||||
InputField::new(window, cx, "")
|
||||
.label(label)
|
||||
.label_min_width(px(64.))
|
||||
});
|
||||
@@ -241,7 +241,7 @@ impl Zeta2Inspector {
|
||||
};
|
||||
|
||||
fn number_input_value<T: FromStr + Default>(
|
||||
input: &Entity<SingleLineInput>,
|
||||
input: &Entity<InputField>,
|
||||
cx: &App,
|
||||
) -> T {
|
||||
input
|
||||
|
||||
Reference in New Issue
Block a user