Not working yet file-finder2

This commit is contained in:
Conrad Irwin 2023-11-14 09:28:18 -07:00
parent 6b366c102e
commit 7d94d8940c
7 changed files with 2247 additions and 2 deletions

25
Cargo.lock generated
View file

@ -3061,6 +3061,30 @@ dependencies = [
"workspace", "workspace",
] ]
[[package]]
name = "file_finder2"
version = "0.1.0"
dependencies = [
"collections",
"ctor",
"editor2",
"env_logger 0.9.3",
"fuzzy2",
"gpui2",
"language2",
"menu2",
"picker2",
"postage",
"project2",
"serde",
"serde_json",
"settings2",
"text2",
"theme2",
"util",
"workspace2",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.22" version = "0.2.22"
@ -11393,6 +11417,7 @@ dependencies = [
"editor2", "editor2",
"env_logger 0.9.3", "env_logger 0.9.3",
"feature_flags2", "feature_flags2",
"file_finder2",
"fs2", "fs2",
"fsevent", "fsevent",
"futures 0.3.28", "futures 0.3.28",

View file

@ -0,0 +1,36 @@
[package]
name = "file_finder2"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/file_finder.rs"
doctest = false
[dependencies]
editor = { package = "editor2", path = "../editor2" }
collections = { path = "../collections" }
fuzzy = { package = "fuzzy2", path = "../fuzzy2" }
gpui = { package = "gpui2", path = "../gpui2" }
menu = { package = "menu2", path = "../menu2" }
picker = { package = "picker2", path = "../picker2" }
project = { package = "project2", path = "../project2" }
settings = { package = "settings2", path = "../settings2" }
text = { package = "text2", path = "../text2" }
util = { path = "../util" }
theme = { package = "theme2", path = "../theme2" }
workspace = { package = "workspace2", path = "../workspace2" }
postage.workspace = true
serde.workspace = true
[dev-dependencies]
editor = { package = "editor2", path = "../editor2", features = ["test-support"] }
gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
language = { package = "language2", path = "../language2", features = ["test-support"] }
workspace = { package = "workspace2", path = "../workspace2", features = ["test-support"] }
theme = { package = "theme2", path = "../theme2", features = ["test-support"] }
serde_json.workspace = true
ctor.workspace = true
env_logger.workspace = true

File diff suppressed because it is too large Load diff

View file

@ -71,6 +71,14 @@ impl ModalLayer {
cx.notify(); cx.notify();
} }
pub fn current_modal<V>(&self) -> Option<View<V>>
where
V: 'static,
{
let active_modal = self.active_modal.as_ref()?;
active_modal.modal.clone().downcast::<V>().ok()
}
} }
impl Render for ModalLayer { impl Render for ModalLayer {

View file

@ -3541,6 +3541,10 @@ impl Workspace {
div div
} }
pub fn current_modal<V: Modal + 'static>(&mut self, cx: &ViewContext<Self>) -> Option<View<V>> {
self.modal_layer.read(cx).current_modal()
}
pub fn toggle_modal<V: Modal, B>(&mut self, cx: &mut ViewContext<Self>, build: B) pub fn toggle_modal<V: Modal, B>(&mut self, cx: &mut ViewContext<Self>, build: B)
where where
B: FnOnce(&mut ViewContext<V>) -> V, B: FnOnce(&mut ViewContext<V>) -> V,

View file

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

View file

@ -186,7 +186,7 @@ fn main() {
// recent_projects::init(cx); // recent_projects::init(cx);
go_to_line::init(cx); go_to_line::init(cx);
// file_finder::init(cx); file_finder::init(cx);
// outline::init(cx); // outline::init(cx);
// project_symbols::init(cx); // project_symbols::init(cx);
// project_panel::init(Assets, cx); // project_panel::init(Assets, cx);