Remove AppState from workspace actions

This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
This commit is contained in:
Max Brunsfeld 2022-05-19 14:37:26 -07:00
parent 7445197f4d
commit ef0b584532
21 changed files with 335 additions and 486 deletions

View file

@ -12,6 +12,7 @@ editor = { path = "../editor" }
fuzzy = { path = "../fuzzy" }
gpui = { path = "../gpui" }
picker = { path = "../picker" }
project = { path = "../project" }
settings = { path = "../settings" }
util = { path = "../util" }
theme = { path = "../theme" }
@ -20,6 +21,7 @@ workspace = { path = "../workspace" }
[dev-dependencies]
gpui = { path = "../gpui", features = ["test-support"] }
editor = { path = "../editor", features = ["test-support"] }
project = { path = "../project", features = ["test-support"] }
serde_json = { version = "1.0.64", features = ["preserve_order"] }
workspace = { path = "../workspace", features = ["test-support"] }
ctor = "0.1"

View file

@ -299,7 +299,8 @@ mod tests {
use super::*;
use editor::Editor;
use gpui::TestAppContext;
use workspace::{Workspace, WorkspaceParams};
use project::Project;
use workspace::{AppState, Workspace};
#[test]
fn test_humanize_action_name() {
@ -319,15 +320,16 @@ mod tests {
#[gpui::test]
async fn test_command_palette(cx: &mut TestAppContext) {
let params = cx.update(WorkspaceParams::test);
let app_state = cx.update(AppState::test);
cx.update(|cx| {
editor::init(cx);
workspace::init(&params.client, cx);
workspace::init(app_state.clone(), cx);
init(cx);
});
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(&params, cx));
let project = Project::test(app_state.fs.clone(), [], cx).await;
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(project, cx));
let editor = cx.add_view(window_id, |cx| {
let mut editor = Editor::single_line(None, cx);
editor.set_text("abc", cx);