first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,60 +1,53 @@
|
||||
use crate::appearance::Appearance;
|
||||
use crate::drive::CloudObjectTypeAndId;
|
||||
use crate::search::binding_source::{BindingFilterFn, BindingSource};
|
||||
use crate::search::command_palette::mixer::CommandPaletteItemAction;
|
||||
use crate::search::command_palette::SelectedItems;
|
||||
use crate::search::result_renderer::QueryResultRenderer;
|
||||
use crate::search::search_bar::SelectionUpdate;
|
||||
use crate::search::search_bar::{SearchBar, SearchBarEvent, SearchBarState, SearchResultOrdering};
|
||||
use crate::search::QueryFilter;
|
||||
use crate::send_telemetry_from_ctx;
|
||||
use crate::server::telemetry::LaunchConfigUiLocation;
|
||||
use crate::server::telemetry::TelemetryEvent;
|
||||
use crate::settings::CtrlTabBehavior;
|
||||
use crate::terminal::keys_settings::KeysSettings;
|
||||
use crate::themes::theme::GalaxyTheme;
|
||||
use crate::view_components::DismissibleToast;
|
||||
use crate::ToastStack;
|
||||
use galaxy_core::send_telemetry_from_app_ctx;
|
||||
use galaxy_util::path::LineAndColumnArg;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::search::action::search_item::MatchedBinding;
|
||||
use galaxyui::elements::DispatchEventResult;
|
||||
use galaxyui::elements::EventHandler;
|
||||
use galaxyui::event::KeyState;
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
use galaxyui::FocusContext;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::search::command_palette::zero_state::{self, Event as ZeroStateEvent, ZeroState};
|
||||
use crate::search::data_source::QueryResult;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::features::FeatureFlag;
|
||||
use crate::palette::PaletteMode;
|
||||
use crate::root_view::OpenLaunchConfigArg;
|
||||
use crate::search::command_palette::data_sources::DataSourceStore;
|
||||
use crate::server::ids::SyncId;
|
||||
use crate::session_management::SessionSource;
|
||||
use crate::workspace::{active_terminal_in_window, ForkedConversationDestination, WorkspaceAction};
|
||||
use itertools::Itertools;
|
||||
use lazy_static::lazy_static;
|
||||
use galaxy_core::send_telemetry_from_app_ctx;
|
||||
use galaxy_util::path::LineAndColumnArg;
|
||||
use galaxyui::elements::{
|
||||
Align, Border, ChildView, Clipped, ClippedScrollStateHandle, ClippedScrollable, ConstrainedBox,
|
||||
Container, CornerRadius, Dismiss, Empty, Fill, Flex, ParentElement, Radius, SavePosition,
|
||||
Shrinkable,
|
||||
Container, CornerRadius, Dismiss, DispatchEventResult, Empty, EventHandler, Fill, Flex,
|
||||
ParentElement, Radius, SavePosition, Shrinkable,
|
||||
};
|
||||
use galaxyui::event::KeyState;
|
||||
use galaxyui::keymap::BindingId;
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
use galaxyui::units::{IntoPixels, Pixels};
|
||||
use galaxyui::{
|
||||
AppContext, Element, Entity, EntityId, ModelHandle, SingletonEntity, TypedActionView,
|
||||
ViewContext, ViewHandle, WindowId,
|
||||
AppContext, Element, Entity, EntityId, FocusContext, ModelHandle, SingletonEntity,
|
||||
TypedActionView, ViewContext, ViewHandle, WindowId,
|
||||
};
|
||||
|
||||
use super::super::palette_styles as styles;
|
||||
use super::CommandPaletteMixer;
|
||||
use crate::appearance::Appearance;
|
||||
use crate::drive::CloudObjectTypeAndId;
|
||||
use crate::features::FeatureFlag;
|
||||
use crate::palette::PaletteMode;
|
||||
use crate::root_view::OpenLaunchConfigArg;
|
||||
use crate::search::action::search_item::MatchedBinding;
|
||||
use crate::search::binding_source::{BindingFilterFn, BindingSource};
|
||||
use crate::search::command_palette::data_sources::DataSourceStore;
|
||||
use crate::search::command_palette::mixer::CommandPaletteItemAction;
|
||||
use crate::search::command_palette::zero_state::{self, Event as ZeroStateEvent, ZeroState};
|
||||
use crate::search::command_palette::SelectedItems;
|
||||
use crate::search::data_source::QueryResult;
|
||||
use crate::search::result_renderer::QueryResultRenderer;
|
||||
use crate::search::search_bar::{
|
||||
SearchBar, SearchBarEvent, SearchBarState, SearchResultOrdering, SelectionUpdate,
|
||||
};
|
||||
use crate::search::QueryFilter;
|
||||
use crate::server::ids::SyncId;
|
||||
use crate::server::telemetry::{LaunchConfigUiLocation, TelemetryEvent};
|
||||
use crate::session_management::SessionSource;
|
||||
use crate::settings::CtrlTabBehavior;
|
||||
use crate::terminal::keys_settings::KeysSettings;
|
||||
use crate::themes::theme::WarpTheme;
|
||||
use crate::view_components::DismissibleToast;
|
||||
use crate::workspace::{active_terminal_in_window, ForkedConversationDestination, WorkspaceAction};
|
||||
use crate::{send_telemetry_from_ctx, ToastStack};
|
||||
|
||||
lazy_static! {
|
||||
/// Set of hardcoded action names that we want to show in the command palette zero state.
|
||||
@@ -179,7 +172,7 @@ impl galaxyui::View for View {
|
||||
let appearance = Appearance::as_ref(app);
|
||||
let theme = appearance.theme();
|
||||
|
||||
let body = if self.search_bar_state.as_ref(app).should_show_zero_state() {
|
||||
let body = if self.search_bar.as_ref(app).should_show_zero_state(app) {
|
||||
ChildView::new(&self.zero_state_handle).finish()
|
||||
} else {
|
||||
self.render_palette_list(theme, app)
|
||||
@@ -337,22 +330,10 @@ impl View {
|
||||
.map(|item| &item.search_result)
|
||||
}
|
||||
|
||||
pub fn set_fixed_query_filters(
|
||||
&mut self,
|
||||
title: String,
|
||||
filters: Vec<QueryFilter>,
|
||||
ctx: &mut ViewContext<Self>,
|
||||
) {
|
||||
self.search_bar.update(ctx, |search_bar, ctx| {
|
||||
search_bar.set_fixed_filters(title, filters, ctx);
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
|
||||
/// Set the active query filter in the search bar to be `filter`.
|
||||
pub fn set_active_query_filter(&mut self, filter: QueryFilter, ctx: &mut ViewContext<Self>) {
|
||||
self.search_bar.update(ctx, |view, ctx| {
|
||||
view.set_visible_query_filter(Some((filter, filter.filter_atom().primary_text)), ctx)
|
||||
view.set_query_filter(Some((filter, filter.filter_atom().primary_text)), ctx)
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
@@ -364,15 +345,15 @@ impl View {
|
||||
}
|
||||
|
||||
pub fn select_next_item(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
self.search_bar_state.update(ctx, |state, ctx| {
|
||||
state.handle_selection_update(SelectionUpdate::Down, ctx);
|
||||
self.search_bar.update(ctx, |search_bar, ctx| {
|
||||
search_bar.handle_selection_update(SelectionUpdate::Down, ctx);
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
|
||||
pub fn select_prev_item(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
self.search_bar_state.update(ctx, |state, ctx| {
|
||||
state.handle_selection_update(SelectionUpdate::Up, ctx);
|
||||
self.search_bar.update(ctx, |search_bar, ctx| {
|
||||
search_bar.handle_selection_update(SelectionUpdate::Up, ctx);
|
||||
});
|
||||
ctx.notify();
|
||||
}
|
||||
@@ -385,9 +366,7 @@ impl View {
|
||||
|
||||
/// Returns the active query filters
|
||||
pub fn active_query_filter(&self, app: &AppContext) -> Option<QueryFilter> {
|
||||
self.search_bar_state
|
||||
.as_ref(app)
|
||||
.active_visible_query_filter()
|
||||
self.search_bar_state.as_ref(app).active_query_filter()
|
||||
}
|
||||
|
||||
pub fn is_mode_enabled(&self, mode: PaletteMode, app: &AppContext) -> bool {
|
||||
@@ -739,10 +718,17 @@ impl View {
|
||||
result_action: CommandPaletteItemAction,
|
||||
ctx: &mut ViewContext<Self>,
|
||||
) {
|
||||
let selected_items_handle = SelectedItems::handle(ctx);
|
||||
selected_items_handle.update(ctx, |selected_items, _ctx| {
|
||||
selected_items.enqueue(result_action.to_summary())
|
||||
});
|
||||
// Tab navigations don't appear in the main command palette to avoid confusion with session
|
||||
// navigations, so they can't evict real recent items from SelectedItems.
|
||||
if !matches!(
|
||||
result_action,
|
||||
CommandPaletteItemAction::NavigateToTab { .. }
|
||||
) {
|
||||
let selected_items_handle = SelectedItems::handle(ctx);
|
||||
selected_items_handle.update(ctx, |selected_items, _ctx| {
|
||||
selected_items.enqueue(result_action.to_summary())
|
||||
});
|
||||
}
|
||||
|
||||
if let CommandPaletteItemAction::AcceptBinding { binding } = &result_action {
|
||||
if let Some(action) = &binding.action {
|
||||
@@ -812,6 +798,20 @@ impl View {
|
||||
|
||||
send_telemetry_from_ctx!(TelemetryEvent::SelectNavigationPaletteItem, ctx);
|
||||
}
|
||||
CommandPaletteItemAction::NavigateToTab {
|
||||
pane_group_id,
|
||||
window_id,
|
||||
} => {
|
||||
if let Some(root_view_id) = ctx.root_view_id(window_id) {
|
||||
ctx.dispatch_action_for_view(
|
||||
window_id,
|
||||
root_view_id,
|
||||
"root_view:activate_tab_by_pane_group_id",
|
||||
&pane_group_id,
|
||||
);
|
||||
}
|
||||
send_telemetry_from_ctx!(TelemetryEvent::SelectNavigationPaletteItem, ctx);
|
||||
}
|
||||
CommandPaletteItemAction::NavigateToConversation {
|
||||
pane_view_locator,
|
||||
window_id,
|
||||
@@ -863,6 +863,7 @@ impl View {
|
||||
summarize_after_fork: false,
|
||||
summarization_prompt: None,
|
||||
initial_prompt: None,
|
||||
initial_attachments: vec![],
|
||||
destination: ForkedConversationDestination::SplitPane,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user