Rename LSP function and simplify tests (#27313)

While working on a fix I found opportunities to improve readability, but
it's a big rename diff, so I'm landing separately.

Release Notes:

- N/A
This commit is contained in:
João Marcos 2025-03-22 16:23:11 -03:00 committed by GitHub
parent f4d1e7901c
commit 9f0b09007b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 641 additions and 642 deletions

View file

@ -1440,7 +1440,7 @@ impl FakeLanguageServer {
}),
notifications_rx,
};
fake.handle_request::<request::Initialize, _, _>({
fake.set_request_handler::<request::Initialize, _, _>({
let capabilities = capabilities;
move |_, _| {
let capabilities = capabilities.clone();
@ -1524,7 +1524,7 @@ impl FakeLanguageServer {
}
/// Registers a handler for a specific kind of request. Removes any existing handler for specified request type.
pub fn handle_request<T, F, Fut>(
pub fn set_request_handler<T, F, Fut>(
&self,
mut handler: F,
) -> futures::channel::mpsc::UnboundedReceiver<()>
@ -1699,7 +1699,7 @@ mod tests {
"file://b/c"
);
fake.handle_request::<request::Shutdown, _, _>(|_, _| async move { Ok(()) });
fake.set_request_handler::<request::Shutdown, _, _>(|_, _| async move { Ok(()) });
drop(server);
fake.receive_notification::<notification::Exit>().await;