wip
This commit is contained in:
parent
2c904cb0bf
commit
bef2013c7f
3 changed files with 40 additions and 13 deletions
|
@ -62,7 +62,7 @@ impl<'a> EditorLspTestContext<'a> {
|
||||||
params
|
params
|
||||||
.fs
|
.fs
|
||||||
.as_fake()
|
.as_fake()
|
||||||
.insert_tree("/root", json!({ "dir": { file_name: "" }}))
|
.insert_tree("/root", json!({ "dir": { file_name.clone(): "" }}))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (window_id, workspace) = cx.add_window(|cx| {
|
let (window_id, workspace) = cx.add_window(|cx| {
|
||||||
|
@ -107,7 +107,7 @@ impl<'a> EditorLspTestContext<'a> {
|
||||||
},
|
},
|
||||||
lsp,
|
lsp,
|
||||||
workspace,
|
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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1009,4 +1009,13 @@ mod test {
|
||||||
.await;
|
.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! {"
|
||||||
|
// "}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use std::ops::{Deref, DerefMut};
|
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 gpui::{json::json, AppContext, ContextHandle, ViewHandle};
|
||||||
use project::Project;
|
use project::Project;
|
||||||
use search::{BufferSearchBar, ProjectSearchBar};
|
use search::{BufferSearchBar, ProjectSearchBar};
|
||||||
|
@ -11,7 +13,7 @@ use crate::{state::Operator, *};
|
||||||
use super::VimBindingTestContext;
|
use super::VimBindingTestContext;
|
||||||
|
|
||||||
pub struct VimTestContext<'a> {
|
pub struct VimTestContext<'a> {
|
||||||
cx: EditorTestContext<'a>,
|
cx: EditorLspTestContext<'a>,
|
||||||
workspace: ViewHandle<Workspace>,
|
workspace: ViewHandle<Workspace>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,19 +28,28 @@ impl<'a> VimTestContext<'a> {
|
||||||
settings::KeymapFileContent::load("keymaps/vim.json", cx).unwrap();
|
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(|cx| {
|
||||||
cx.update_global(|settings: &mut Settings, _| {
|
cx.update_global(|settings: &mut Settings, _| {
|
||||||
settings.vim_mode = enabled;
|
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
|
params
|
||||||
.fs
|
.fs
|
||||||
.as_fake()
|
.as_fake()
|
||||||
.insert_tree("/root", json!({ "dir": { "test.txt": "" } }))
|
.insert_tree("/root", json!({ "dir": { "test.rs": "" } }))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (window_id, workspace) = cx.add_window(|cx| {
|
let (window_id, workspace) = cx.add_window(|cx| {
|
||||||
|
@ -87,12 +98,19 @@ impl<'a> VimTestContext<'a> {
|
||||||
});
|
});
|
||||||
editor.update(cx, |_, cx| cx.focus_self());
|
editor.update(cx, |_, cx| cx.focus_self());
|
||||||
|
|
||||||
|
let lsp = fake_servers.next().await.unwrap();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
cx: EditorLspTestContext {
|
||||||
cx: EditorTestContext {
|
cx: EditorTestContext {
|
||||||
cx,
|
cx,
|
||||||
window_id,
|
window_id,
|
||||||
editor,
|
editor,
|
||||||
},
|
},
|
||||||
|
lsp,
|
||||||
|
workspace,
|
||||||
|
buffer_lsp_url: lsp::Url::from_file_path("/root/dir/file.rs").unwrap(),
|
||||||
|
},
|
||||||
workspace,
|
workspace,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +119,7 @@ impl<'a> VimTestContext<'a> {
|
||||||
where
|
where
|
||||||
F: FnOnce(&Workspace, &AppContext) -> T,
|
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) {
|
pub fn enable_vim(&mut self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue