fix: Do not retry inlay hint requests
This commit is contained in:
parent
ad91622d11
commit
74e08cb60d
@ -87,6 +87,42 @@ impl<'a> RequestDispatcher<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Dispatches the request onto thread pool
|
||||||
|
pub(crate) fn on_no_retry<R>(
|
||||||
|
&mut self,
|
||||||
|
f: fn(GlobalStateSnapshot, R::Params) -> Result<R::Result>,
|
||||||
|
) -> &mut Self
|
||||||
|
where
|
||||||
|
R: lsp_types::request::Request + 'static,
|
||||||
|
R::Params: DeserializeOwned + panic::UnwindSafe + Send + fmt::Debug,
|
||||||
|
R::Result: Serialize,
|
||||||
|
{
|
||||||
|
let (req, params, panic_context) = match self.parse::<R>() {
|
||||||
|
Some(it) => it,
|
||||||
|
None => return self,
|
||||||
|
};
|
||||||
|
|
||||||
|
self.global_state.task_pool.handle.spawn({
|
||||||
|
let world = self.global_state.snapshot();
|
||||||
|
move || {
|
||||||
|
let result = panic::catch_unwind(move || {
|
||||||
|
let _pctx = stdx::panic_context::enter(panic_context);
|
||||||
|
f(world, params)
|
||||||
|
});
|
||||||
|
match thread_result_to_response::<R>(req.id.clone(), result) {
|
||||||
|
Ok(response) => Task::Response(response),
|
||||||
|
Err(_) => Task::Response(lsp_server::Response::new_err(
|
||||||
|
req.id,
|
||||||
|
lsp_server::ErrorCode::ContentModified as i32,
|
||||||
|
"content modified".to_string(),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Dispatches the request onto thread pool
|
/// Dispatches the request onto thread pool
|
||||||
pub(crate) fn on<R>(
|
pub(crate) fn on<R>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -653,7 +653,7 @@ impl GlobalState {
|
|||||||
.on::<lsp_types::request::GotoDeclaration>(handlers::handle_goto_declaration)
|
.on::<lsp_types::request::GotoDeclaration>(handlers::handle_goto_declaration)
|
||||||
.on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)
|
.on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)
|
||||||
.on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)
|
.on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)
|
||||||
.on::<lsp_types::request::InlayHintRequest>(handlers::handle_inlay_hints)
|
.on_no_retry::<lsp_types::request::InlayHintRequest>(handlers::handle_inlay_hints)
|
||||||
.on::<lsp_types::request::InlayHintResolveRequest>(handlers::handle_inlay_hints_resolve)
|
.on::<lsp_types::request::InlayHintResolveRequest>(handlers::handle_inlay_hints_resolve)
|
||||||
.on::<lsp_types::request::Completion>(handlers::handle_completion)
|
.on::<lsp_types::request::Completion>(handlers::handle_completion)
|
||||||
.on::<lsp_types::request::ResolveCompletionItem>(handlers::handle_completion_resolve)
|
.on::<lsp_types::request::ResolveCompletionItem>(handlers::handle_completion_resolve)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user