Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

wip

Kay Simmonsbef2013c7fb9
diff --git a/crates/editor/src/test/editor_lsp_test_context.rs b/crates/editor/src/test/editor_lsp_test_context.rs
index 7f92190489a..89d59d853b5 100644
--- a/crates/editor/src/test/editor_lsp_test_context.rs
+++ b/crates/editor/src/test/editor_lsp_test_context.rs
@@ -62,7 +62,7 @@ impl<'a> EditorLspTestContext<'a> {
params
.fs
.as_fake()
- .insert_tree("/root", json!({ "dir": { file_name: "" }}))
+ .insert_tree("/root", json!({ "dir": { file_name.clone(): "" }}))
.await;
let (window_id, workspace) = cx.add_window(|cx| {
@@ -107,7 +107,7 @@ impl<'a> EditorLspTestContext<'a> {
},
lsp,
workspace,
- buffer_lsp_url: lsp::Url::from_file_path("/root/dir/file.rs").unwrap(),
+ buffer_lsp_url: lsp::Url::from_file_path(format!("/root/dir/{file_name}")).unwrap(),
}
}
diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs
index 742f2426c8a..f4d79ba89b4 100644
--- a/crates/vim/src/normal.rs
+++ b/crates/vim/src/normal.rs
@@ -1009,4 +1009,13 @@ mod test {
.await;
}
}
+
+ #[gpui::test]
+ async fn test_percent(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ for count in 1..=2 {
+ // let test_case = indoc! {"
+ // "}
+ }
+ }
}
diff --git a/crates/vim/src/test/vim_test_context.rs b/crates/vim/src/test/vim_test_context.rs
index 539ab0a8ff7..4ac01c3f34f 100644
--- a/crates/vim/src/test/vim_test_context.rs
+++ b/crates/vim/src/test/vim_test_context.rs
@@ -1,6 +1,8 @@
use std::ops::{Deref, DerefMut};
-use editor::test::editor_test_context::EditorTestContext;
+use editor::test::{
+ editor_lsp_test_context::EditorLspTestContext, editor_test_context::EditorTestContext,
+};
use gpui::{json::json, AppContext, ContextHandle, ViewHandle};
use project::Project;
use search::{BufferSearchBar, ProjectSearchBar};
@@ -11,7 +13,7 @@ use crate::{state::Operator, *};
use super::VimBindingTestContext;
pub struct VimTestContext<'a> {
- cx: EditorTestContext<'a>,
+ cx: EditorLspTestContext<'a>,
workspace: ViewHandle<Workspace>,
}
@@ -26,19 +28,28 @@ impl<'a> VimTestContext<'a> {
settings::KeymapFileContent::load("keymaps/vim.json", cx).unwrap();
});
- let params = cx.update(AppState::test);
- let project = Project::test(params.fs.clone(), [], cx).await;
-
cx.update(|cx| {
cx.update_global(|settings: &mut Settings, _| {
settings.vim_mode = enabled;
});
});
+ let params = cx.update(AppState::test);
+
+ let file_name = "test.rs";
+ let mut fake_servers = language
+ .set_fake_lsp_adapter(Arc::new(FakeLspAdapter {
+ ..Default::default()
+ }))
+ .await;
+
+ let project = Project::test(params.fs.clone(), [], cx).await;
+ project.update(cx, |project, _| project.languages().add(Arc::new(language)));
+
params
.fs
.as_fake()
- .insert_tree("/root", json!({ "dir": { "test.txt": "" } }))
+ .insert_tree("/root", json!({ "dir": { "test.rs": "" } }))
.await;
let (window_id, workspace) = cx.add_window(|cx| {
@@ -87,11 +98,18 @@ impl<'a> VimTestContext<'a> {
});
editor.update(cx, |_, cx| cx.focus_self());
+ let lsp = fake_servers.next().await.unwrap();
+
Self {
- cx: EditorTestContext {
- cx,
- window_id,
- editor,
+ cx: EditorLspTestContext {
+ cx: EditorTestContext {
+ cx,
+ window_id,
+ editor,
+ },
+ lsp,
+ workspace,
+ buffer_lsp_url: lsp::Url::from_file_path("/root/dir/file.rs").unwrap(),
},
workspace,
}
@@ -101,7 +119,7 @@ impl<'a> VimTestContext<'a> {
where
F: FnOnce(&Workspace, &AppContext) -> T,
{
- self.workspace.read_with(self.cx.cx, read)
+ self.workspace.read_with(self.cx.cx.cx, read)
}
pub fn enable_vim(&mut self) {