From fcf416e118688f48377e383162e351913c2623ee Mon Sep 17 00:00:00 2001 From: Micah Date: Sat, 30 Nov 2024 01:07:33 -0600 Subject: [PATCH] fix lsp `WithFallback` service --- crates/language-server/src/fallback.rs | 41 ++++---------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/crates/language-server/src/fallback.rs b/crates/language-server/src/fallback.rs index afab226b3..e57983fe1 100644 --- a/crates/language-server/src/fallback.rs +++ b/crates/language-server/src/fallback.rs @@ -39,14 +39,11 @@ where } fn call(&mut self, req: AnyRequest) -> Self::Future { - self.primary.call(req) - // if self.primary.can_handle(&req) { - // info!("primary can handle {}", req.method); - // self.primary.call(req) - // } else { - // info!("handling via fallback {}", req.method); - // self.fallback.call(req) - // } + if self.primary.can_handle(&req) { + self.primary.call(req) + } else { + self.fallback.call(req) + } } } @@ -81,31 +78,3 @@ where } } } - -// pub struct WithFallbackLayer { -// fallback: B, -// } - -// impl WithFallbackLayer { -// pub fn new(fallback: B) -> Self { -// Self { fallback } -// } -// } - -// impl tower::Layer for WithFallbackLayer -// where -// A: Service -// + CanHandle -// + CanHandle -// + CanHandle, -// B: Service, -// { -// type Service = WithFallbackService; - -// fn layer(&self, primary: A) -> Self::Service { -// WithFallbackService::new( -// primary, -// std::mem::replace(&mut self.fallback, unsafe { std::mem::uninitialized() }), -// ) -// } -// }