This is just a buffer search (without project search), as the latter
needs a multibuffer from `editor`
Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2023-11-21 01:38:14 +01:00 committed by GitHub
commit b4275008f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 4907 additions and 58 deletions

30
Cargo.lock generated
View File

@ -8007,6 +8007,35 @@ dependencies = [
"workspace",
]
[[package]]
name = "search2"
version = "0.1.0"
dependencies = [
"anyhow",
"bitflags 1.3.2",
"client2",
"collections",
"editor2",
"futures 0.3.28",
"gpui2",
"language2",
"log",
"menu2",
"postage",
"project2",
"serde",
"serde_derive",
"serde_json",
"settings2",
"smallvec",
"smol",
"theme2",
"ui2",
"unindent",
"util",
"workspace2",
]
[[package]]
name = "security-framework"
version = "2.9.2"
@ -11597,6 +11626,7 @@ dependencies = [
"rsa 0.4.0",
"rust-embed",
"schemars",
"search2",
"serde",
"serde_derive",
"serde_json",

View File

@ -90,6 +90,7 @@ members = [
"crates/rpc",
"crates/rpc2",
"crates/search",
"crates/search2",
"crates/settings",
"crates/settings2",
"crates/snippet",

View File

@ -742,7 +742,7 @@ impl Item for ProjectDiagnosticsEditor {
}
fn breadcrumb_location(&self) -> ToolbarItemLocation {
ToolbarItemLocation::PrimaryLeft { flex: None }
ToolbarItemLocation::PrimaryLeft
}
fn breadcrumbs(&self, theme: &theme::Theme, cx: &AppContext) -> Option<Vec<BreadcrumbText>> {

View File

@ -49,7 +49,7 @@ impl ToolbarItemView for ToolbarControls {
if let Some(pane_item) = active_pane_item.as_ref() {
if let Some(editor) = pane_item.downcast::<ProjectDiagnosticsEditor>() {
self.editor = Some(editor.downgrade());
ToolbarItemLocation::PrimaryRight { flex: None }
ToolbarItemLocation::PrimaryRight
} else {
ToolbarItemLocation::Hidden
}

View File

@ -2325,6 +2325,7 @@ impl Editor {
self.blink_manager.update(cx, BlinkManager::pause_blinking);
cx.emit(EditorEvent::SelectionsChanged { local });
cx.emit(SearchEvent::MatchesInvalidated);
if self.selections.disjoint_anchors().len() == 1 {
cx.emit(SearchEvent::ActiveMatchChanged)

View File

@ -761,7 +761,7 @@ impl Item for Editor {
}
fn breadcrumb_location(&self) -> ToolbarItemLocation {
ToolbarItemLocation::PrimaryLeft { flex: None }
ToolbarItemLocation::PrimaryLeft
}
fn breadcrumbs(&self, variant: &Theme, cx: &AppContext) -> Option<Vec<BreadcrumbText>> {
@ -907,17 +907,15 @@ impl SearchableItem for Editor {
type Match = Range<Anchor>;
fn clear_matches(&mut self, cx: &mut ViewContext<Self>) {
todo!()
// self.clear_background_highlights::<BufferSearchHighlights>(cx);
self.clear_background_highlights::<BufferSearchHighlights>(cx);
}
fn update_matches(&mut self, matches: Vec<Range<Anchor>>, cx: &mut ViewContext<Self>) {
todo!()
// self.highlight_background::<BufferSearchHighlights>(
// matches,
// |theme| theme.search.match_background,
// cx,
// );
self.highlight_background::<BufferSearchHighlights>(
matches,
|theme| theme.title_bar_background, // todo: update theme
cx,
);
}
fn query_suggestion(&mut self, cx: &mut ViewContext<Self>) -> String {
@ -952,22 +950,20 @@ impl SearchableItem for Editor {
matches: Vec<Range<Anchor>>,
cx: &mut ViewContext<Self>,
) {
todo!()
// self.unfold_ranges([matches[index].clone()], false, true, cx);
// let range = self.range_for_match(&matches[index]);
// self.change_selections(Some(Autoscroll::fit()), cx, |s| {
// s.select_ranges([range]);
// })
self.unfold_ranges([matches[index].clone()], false, true, cx);
let range = self.range_for_match(&matches[index]);
self.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.select_ranges([range]);
})
}
fn select_matches(&mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
todo!()
// self.unfold_ranges(matches.clone(), false, false, cx);
// let mut ranges = Vec::new();
// for m in &matches {
// ranges.push(self.range_for_match(&m))
// }
// self.change_selections(None, cx, |s| s.select_ranges(ranges));
self.unfold_ranges(matches.clone(), false, false, cx);
let mut ranges = Vec::new();
for m in &matches {
ranges.push(self.range_for_match(&m))
}
self.change_selections(None, cx, |s| s.select_ranges(ranges));
}
fn replace(
&mut self,

View File

@ -1,8 +1,9 @@
use crate::{
div, Action, AnyView, AnyWindowHandle, AppCell, AppContext, AsyncAppContext,
BackgroundExecutor, Context, Div, EventEmitter, ForegroundExecutor, InputEvent, KeyDownEvent,
Keystroke, Model, ModelContext, Render, Result, Task, TestDispatcher, TestPlatform, TestWindow,
View, ViewContext, VisualContext, WindowContext, WindowHandle, WindowOptions,
BackgroundExecutor, Context, Div, Entity, EventEmitter, ForegroundExecutor, InputEvent,
KeyDownEvent, Keystroke, Model, ModelContext, Render, Result, Task, TestDispatcher,
TestPlatform, TestWindow, View, ViewContext, VisualContext, WindowContext, WindowHandle,
WindowOptions,
};
use anyhow::{anyhow, bail};
use futures::{Stream, StreamExt};
@ -296,21 +297,19 @@ impl TestAppContext {
.unwrap()
}
pub fn notifications<T: 'static>(&mut self, entity: &Model<T>) -> impl Stream<Item = ()> {
pub fn notifications<T: 'static>(&mut self, entity: &impl Entity<T>) -> impl Stream<Item = ()> {
let (tx, rx) = futures::channel::mpsc::unbounded();
entity.update(self, move |_, cx: &mut ModelContext<T>| {
self.update(|cx| {
cx.observe(entity, {
let tx = tx.clone();
move |_, _, _| {
move |_, _| {
let _ = tx.unbounded_send(());
}
})
.detach();
cx.on_release(move |_, _| tx.close_channel()).detach();
cx.observe_release(entity, move |_, _| tx.close_channel())
.detach()
});
rx
}

40
crates/search2/Cargo.toml Normal file
View File

@ -0,0 +1,40 @@
[package]
name = "search2"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/search.rs"
doctest = false
[dependencies]
bitflags = "1"
collections = { path = "../collections" }
editor = { package = "editor2", path = "../editor2" }
gpui = { package = "gpui2", path = "../gpui2" }
language = { package = "language2", path = "../language2" }
menu = { package = "menu2", path = "../menu2" }
project = { package = "project2", path = "../project2" }
settings = { package = "settings2", path = "../settings2" }
theme = { package = "theme2", path = "../theme2" }
util = { path = "../util" }
ui = {package = "ui2", path = "../ui2"}
workspace = { package = "workspace2", path = "../workspace2" }
#semantic_index = { path = "../semantic_index" }
anyhow.workspace = true
futures.workspace = true
log.workspace = true
postage.workspace = true
serde.workspace = true
serde_derive.workspace = true
smallvec.workspace = true
smol.workspace = true
serde_json.workspace = true
[dev-dependencies]
client = { package = "client2", path = "../client2", features = ["test-support"] }
editor = { package = "editor2", path = "../editor2", features = ["test-support"] }
gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
workspace = { package = "workspace2", path = "../workspace2", features = ["test-support"] }
unindent.workspace = true

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
use smallvec::SmallVec;
const SEARCH_HISTORY_LIMIT: usize = 20;
#[derive(Default, Debug, Clone)]
pub struct SearchHistory {
history: SmallVec<[String; SEARCH_HISTORY_LIMIT]>,
selected: Option<usize>,
}
impl SearchHistory {
pub fn add(&mut self, search_string: String) {
if let Some(i) = self.selected {
if search_string == self.history[i] {
return;
}
}
if let Some(previously_searched) = self.history.last_mut() {
if search_string.find(previously_searched.as_str()).is_some() {
*previously_searched = search_string;
self.selected = Some(self.history.len() - 1);
return;
}
}
self.history.push(search_string);
if self.history.len() > SEARCH_HISTORY_LIMIT {
self.history.remove(0);
}
self.selected = Some(self.history.len() - 1);
}
pub fn next(&mut self) -> Option<&str> {
let history_size = self.history.len();
if history_size == 0 {
return None;
}
let selected = self.selected?;
if selected == history_size - 1 {
return None;
}
let next_index = selected + 1;
self.selected = Some(next_index);
Some(&self.history[next_index])
}
pub fn current(&self) -> Option<&str> {
Some(&self.history[self.selected?])
}
pub fn previous(&mut self) -> Option<&str> {
let history_size = self.history.len();
if history_size == 0 {
return None;
}
let prev_index = match self.selected {
Some(selected_index) => {
if selected_index == 0 {
return None;
} else {
selected_index - 1
}
}
None => history_size - 1,
};
self.selected = Some(prev_index);
Some(&self.history[prev_index])
}
pub fn reset_selection(&mut self) {
self.selected = None;
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_add() {
let mut search_history = SearchHistory::default();
assert_eq!(
search_history.current(),
None,
"No current selection should be set fo the default search history"
);
search_history.add("rust".to_string());
assert_eq!(
search_history.current(),
Some("rust"),
"Newly added item should be selected"
);
// check if duplicates are not added
search_history.add("rust".to_string());
assert_eq!(
search_history.history.len(),
1,
"Should not add a duplicate"
);
assert_eq!(search_history.current(), Some("rust"));
// check if new string containing the previous string replaces it
search_history.add("rustlang".to_string());
assert_eq!(
search_history.history.len(),
1,
"Should replace previous item if it's a substring"
);
assert_eq!(search_history.current(), Some("rustlang"));
// push enough items to test SEARCH_HISTORY_LIMIT
for i in 0..SEARCH_HISTORY_LIMIT * 2 {
search_history.add(format!("item{i}"));
}
assert!(search_history.history.len() <= SEARCH_HISTORY_LIMIT);
}
#[test]
fn test_next_and_previous() {
let mut search_history = SearchHistory::default();
assert_eq!(
search_history.next(),
None,
"Default search history should not have a next item"
);
search_history.add("Rust".to_string());
assert_eq!(search_history.next(), None);
search_history.add("JavaScript".to_string());
assert_eq!(search_history.next(), None);
search_history.add("TypeScript".to_string());
assert_eq!(search_history.next(), None);
assert_eq!(search_history.current(), Some("TypeScript"));
assert_eq!(search_history.previous(), Some("JavaScript"));
assert_eq!(search_history.current(), Some("JavaScript"));
assert_eq!(search_history.previous(), Some("Rust"));
assert_eq!(search_history.current(), Some("Rust"));
assert_eq!(search_history.previous(), None);
assert_eq!(search_history.current(), Some("Rust"));
assert_eq!(search_history.next(), Some("JavaScript"));
assert_eq!(search_history.current(), Some("JavaScript"));
assert_eq!(search_history.next(), Some("TypeScript"));
assert_eq!(search_history.current(), Some("TypeScript"));
assert_eq!(search_history.next(), None);
assert_eq!(search_history.current(), Some("TypeScript"));
}
#[test]
fn test_reset_selection() {
let mut search_history = SearchHistory::default();
search_history.add("Rust".to_string());
search_history.add("JavaScript".to_string());
search_history.add("TypeScript".to_string());
assert_eq!(search_history.current(), Some("TypeScript"));
search_history.reset_selection();
assert_eq!(search_history.current(), None);
assert_eq!(
search_history.previous(),
Some("TypeScript"),
"Should start from the end after reset on previous item query"
);
search_history.previous();
assert_eq!(search_history.current(), Some("JavaScript"));
search_history.previous();
assert_eq!(search_history.current(), Some("Rust"));
search_history.reset_selection();
assert_eq!(search_history.current(), None);
}
}

View File

@ -0,0 +1,32 @@
// TODO: Update the default search mode to get from config
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub enum SearchMode {
#[default]
Text,
Semantic,
Regex,
}
impl SearchMode {
pub(crate) fn label(&self) -> &'static str {
match self {
SearchMode::Text => "Text",
SearchMode::Semantic => "Semantic",
SearchMode::Regex => "Regex",
}
}
}
pub(crate) fn next_mode(mode: &SearchMode, semantic_enabled: bool) -> SearchMode {
match mode {
SearchMode::Text => SearchMode::Regex,
SearchMode::Regex => {
if semantic_enabled {
SearchMode::Semantic
} else {
SearchMode::Text
}
}
SearchMode::Semantic => SearchMode::Text,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,117 @@
use bitflags::bitflags;
pub use buffer_search::BufferSearchBar;
use gpui::{actions, Action, AppContext, RenderOnce};
pub use mode::SearchMode;
use project::search::SearchQuery;
use ui::ButtonVariant;
//pub use project_search::{ProjectSearchBar, ProjectSearchView};
// use theme::components::{
// action_button::Button, svg::Svg, ComponentExt, IconButtonStyle, ToggleIconButtonStyle,
// };
pub mod buffer_search;
mod history;
mod mode;
//pub mod project_search;
pub(crate) mod search_bar;
pub fn init(cx: &mut AppContext) {
buffer_search::init(cx);
//project_search::init(cx);
}
actions!(
CycleMode,
ToggleWholeWord,
ToggleCaseSensitive,
ToggleReplace,
SelectNextMatch,
SelectPrevMatch,
SelectAllMatches,
NextHistoryQuery,
PreviousHistoryQuery,
ActivateTextMode,
ActivateSemanticMode,
ActivateRegexMode,
ReplaceAll,
ReplaceNext,
);
bitflags! {
#[derive(Default)]
pub struct SearchOptions: u8 {
const NONE = 0b000;
const WHOLE_WORD = 0b001;
const CASE_SENSITIVE = 0b010;
}
}
impl SearchOptions {
pub fn label(&self) -> &'static str {
match *self {
SearchOptions::WHOLE_WORD => "Match Whole Word",
SearchOptions::CASE_SENSITIVE => "Match Case",
_ => panic!("{:?} is not a named SearchOption", self),
}
}
pub fn icon(&self) -> ui::Icon {
match *self {
SearchOptions::WHOLE_WORD => ui::Icon::WholeWord,
SearchOptions::CASE_SENSITIVE => ui::Icon::CaseSensitive,
_ => panic!("{:?} is not a named SearchOption", self),
}
}
pub fn to_toggle_action(&self) -> Box<dyn Action + Sync + Send + 'static> {
match *self {
SearchOptions::WHOLE_WORD => Box::new(ToggleWholeWord),
SearchOptions::CASE_SENSITIVE => Box::new(ToggleCaseSensitive),
_ => panic!("{:?} is not a named SearchOption", self),
}
}
pub fn none() -> SearchOptions {
SearchOptions::NONE
}
pub fn from_query(query: &SearchQuery) -> SearchOptions {
let mut options = SearchOptions::NONE;
options.set(SearchOptions::WHOLE_WORD, query.whole_word());
options.set(SearchOptions::CASE_SENSITIVE, query.case_sensitive());
options
}
pub fn as_button(&self, active: bool) -> impl RenderOnce {
ui::IconButton::new(0, self.icon())
.on_click({
let action = self.to_toggle_action();
move |_, cx| {
cx.dispatch_action(action.boxed_clone());
}
})
.variant(ui::ButtonVariant::Ghost)
.when(active, |button| button.variant(ButtonVariant::Filled))
}
}
fn toggle_replace_button(active: bool) -> impl RenderOnce {
// todo: add toggle_replace button
ui::IconButton::new(0, ui::Icon::Replace)
.on_click(|_, cx| {
cx.dispatch_action(Box::new(ToggleReplace));
cx.notify();
})
.variant(ui::ButtonVariant::Ghost)
.when(active, |button| button.variant(ButtonVariant::Filled))
}
fn render_replace_button(
action: impl Action + 'static + Send + Sync,
icon: ui::Icon,
) -> impl RenderOnce {
// todo: add tooltip
ui::IconButton::new(0, icon).on_click(move |_, cx| {
cx.dispatch_action(action.boxed_clone());
})
}

View File

@ -0,0 +1,35 @@
use gpui::{MouseDownEvent, RenderOnce, WindowContext};
use ui::{Button, ButtonVariant, IconButton};
use crate::mode::SearchMode;
pub(super) fn render_nav_button(
icon: ui::Icon,
_active: bool,
on_click: impl Fn(&MouseDownEvent, &mut WindowContext) + 'static,
) -> impl RenderOnce {
// let tooltip_style = cx.theme().tooltip.clone();
// let cursor_style = if active {
// CursorStyle::PointingHand
// } else {
// CursorStyle::default()
// };
// enum NavButton {}
IconButton::new("search-nav-button", icon).on_click(on_click)
}
pub(crate) fn render_search_mode_button(
mode: SearchMode,
is_active: bool,
on_click: impl Fn(&MouseDownEvent, &mut WindowContext) + 'static,
) -> Button {
let button_variant = if is_active {
ButtonVariant::Filled
} else {
ButtonVariant::Ghost
};
Button::new(mode.label())
.on_click(on_click)
.variant(button_variant)
}

View File

@ -785,7 +785,7 @@ impl Item for TerminalView {
// }
fn breadcrumb_location(&self) -> ToolbarItemLocation {
ToolbarItemLocation::PrimaryLeft { flex: None }
ToolbarItemLocation::PrimaryLeft
}
fn breadcrumbs(&self, _: &theme::Theme, cx: &AppContext) -> Option<Vec<BreadcrumbText>> {

View File

@ -66,6 +66,8 @@ pub enum Icon {
SplitMessage,
Terminal,
XCircle,
WholeWord,
CaseSensitive,
}
impl Icon {
@ -125,6 +127,8 @@ impl Icon {
Icon::SplitMessage => "icons/split_message.svg",
Icon::Terminal => "icons/terminal.svg",
Icon::XCircle => "icons/error.svg",
Icon::WholeWord => "icons/word_search.svg",
Icon::CaseSensitive => "icons/case_insensitive.svg",
}
}
}

View File

@ -1939,9 +1939,7 @@ impl Render for Pane {
}),
)
.child(self.render_tab_bar(cx))
// .child(
// div()
// ) /* todo!(toolbar) */
.child(self.toolbar.clone())
.child(if let Some(item) = self.active_item() {
div().flex().flex_1().child(item.to_any())
} else {

View File

@ -1,7 +1,8 @@
use std::{any::Any, sync::Arc};
use gpui::{
AnyView, AppContext, EventEmitter, Subscription, Task, View, ViewContext, WindowContext,
AnyView, AppContext, EventEmitter, Subscription, Task, View, ViewContext, WeakView,
WindowContext,
};
use project2::search::SearchQuery;
@ -129,8 +130,7 @@ pub trait SearchableItemHandle: ItemHandle {
// todo!("here is where we need to use AnyWeakView");
impl<T: SearchableItem> SearchableItemHandle for View<T> {
fn downgrade(&self) -> Box<dyn WeakSearchableItemHandle> {
// Box::new(self.downgrade())
todo!()
Box::new(self.downgrade())
}
fn boxed_clone(&self) -> Box<dyn SearchableItemHandle> {
@ -252,16 +252,15 @@ pub trait WeakSearchableItemHandle: WeakItemHandle {
// fn into_any(self) -> AnyWeakView;
}
// todo!()
// impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
// fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn SearchableItemHandle>> {
// Some(Box::new(self.upgrade(cx)?))
// }
impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn SearchableItemHandle>> {
Some(Box::new(self.upgrade()?))
}
// // fn into_any(self) -> AnyView {
// // self.into_any()
// // }
// }
// fn into_any(self) -> AnyView {
// self.into_any()
// }
}
impl PartialEq for Box<dyn WeakSearchableItemHandle> {
fn eq(&self, other: &Self) -> bool {

View File

@ -1,7 +1,10 @@
use crate::ItemHandle;
use gpui::{
AnyView, Div, Entity, EntityId, EventEmitter, Render, View, ViewContext, WindowContext,
AnyView, Div, Entity, EntityId, EventEmitter, ParentElement as _, Render, Styled, View,
ViewContext, WindowContext,
};
use theme2::ActiveTheme;
use ui::{h_stack, v_stack, Button, Icon, IconButton, Label, TextColor};
pub enum ToolbarItemEvent {
ChangeLocation(ToolbarItemLocation),
@ -39,8 +42,8 @@ trait ToolbarItemViewHandle: Send {
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ToolbarItemLocation {
Hidden,
PrimaryLeft { flex: Option<(f32, bool)> },
PrimaryRight { flex: Option<(f32, bool)> },
PrimaryLeft,
PrimaryRight,
Secondary,
}
@ -51,11 +54,56 @@ pub struct Toolbar {
items: Vec<(Box<dyn ToolbarItemViewHandle>, ToolbarItemLocation)>,
}
impl Toolbar {
fn left_items(&self) -> impl Iterator<Item = &dyn ToolbarItemViewHandle> {
self.items.iter().filter_map(|(item, location)| {
if *location == ToolbarItemLocation::PrimaryLeft {
Some(item.as_ref())
} else {
None
}
})
}
fn right_items(&self) -> impl Iterator<Item = &dyn ToolbarItemViewHandle> {
self.items.iter().filter_map(|(item, location)| {
if *location == ToolbarItemLocation::PrimaryRight {
Some(item.as_ref())
} else {
None
}
})
}
}
impl Render for Toolbar {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()
//dbg!(&self.items.len());
v_stack()
.border_b()
.border_color(cx.theme().colors().border)
.child(
h_stack()
.justify_between()
.child(
// Toolbar left side
h_stack()
.p_1()
.child(Button::new("crates"))
.child(Label::new("/").color(TextColor::Muted))
.child(Button::new("workspace2")),
)
// Toolbar right side
.child(
h_stack()
.p_1()
.child(IconButton::new("buffer-search", Icon::MagnifyingGlass))
.child(IconButton::new("inline-assist", Icon::MagicWand)),
),
)
.children(self.items.iter().map(|(child, _)| child.to_any()))
}
}

View File

@ -36,7 +36,7 @@ db = { package = "db2", path = "../db2" }
editor = { package="editor2", path = "../editor2" }
# feedback = { path = "../feedback" }
file_finder = { package="file_finder2", path = "../file_finder2" }
# search = { path = "../search" }
search = { package = "search2", path = "../search2" }
fs = { package = "fs2", path = "../fs2" }
fsevent = { path = "../fsevent" }
go_to_line = { package = "go_to_line2", path = "../go_to_line2" }

View File

@ -199,7 +199,7 @@ fn main() {
project_panel::init(Assets, cx);
// channel::init(&client, user_store.clone(), cx);
// diagnostics::init(cx);
// search::init(cx);
search::init(cx);
// semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
// vim::init(cx);
terminal_view::init(cx);

View File

@ -98,8 +98,8 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
// todo!()
// let breadcrumbs = cx.add_view(|_| Breadcrumbs::new(workspace));
// toolbar.add_item(breadcrumbs, cx);
// let buffer_search_bar = cx.add_view(BufferSearchBar::new);
// toolbar.add_item(buffer_search_bar.clone(), cx);
let buffer_search_bar = cx.build_view(search::BufferSearchBar::new);
toolbar.add_item(buffer_search_bar.clone(), cx);
// let quick_action_bar = cx.add_view(|_| {
// QuickActionBar::new(buffer_search_bar, workspace)
// });