vim: Fix renaming (#7714)

This was broken by #7647

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-02-12 22:28:26 -07:00 committed by GitHub
parent 04fc0dde1a
commit a1899bac4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 68 additions and 24 deletions

View file

@ -1,11 +1,7 @@
use std::ops::{Deref, DerefMut};
use editor::test::{
editor_lsp_test_context::EditorLspTestContext, editor_test_context::EditorTestContext,
};
use futures::Future;
use editor::test::editor_lsp_test_context::EditorLspTestContext;
use gpui::{Context, View, VisualContext};
use lsp::request;
use search::{project_search::ProjectSearchBar, BufferSearchBar};
use crate::{state::Operator, *};
@ -38,7 +34,17 @@ impl VimTestContext {
pub async fn new_typescript(cx: &mut gpui::TestAppContext) -> VimTestContext {
Self::init(cx);
Self::new_with_lsp(
EditorLspTestContext::new_typescript(Default::default(), cx).await,
EditorLspTestContext::new_typescript(
lsp::ServerCapabilities {
rename_provider: Some(lsp::OneOf::Right(lsp::RenameOptions {
prepare_provider: Some(true),
work_done_progress_options: Default::default(),
})),
..Default::default()
},
cx,
)
.await,
true,
)
}
@ -149,23 +155,10 @@ impl VimTestContext {
assert_eq!(self.mode(), mode_after, "{}", self.assertion_context());
assert_eq!(self.active_operator(), None, "{}", self.assertion_context());
}
pub fn handle_request<T, F, Fut>(
&self,
handler: F,
) -> futures::channel::mpsc::UnboundedReceiver<()>
where
T: 'static + request::Request,
T::Params: 'static + Send,
F: 'static + Send + FnMut(lsp::Url, T::Params, gpui::AsyncAppContext) -> Fut,
Fut: 'static + Send + Future<Output = Result<T::Result>>,
{
self.cx.handle_request::<T, F, Fut>(handler)
}
}
impl Deref for VimTestContext {
type Target = EditorTestContext;
type Target = EditorLspTestContext;
fn deref(&self) -> &Self::Target {
&self.cx