aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 8a7c53d2c..452499497 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -315,14 +315,18 @@ fn on_request(
315 request_received, 315 request_received,
316 }; 316 };
317 pool_dispatcher 317 pool_dispatcher
318 .on_sync::<req::CollectGarbage>(|state, ()| Ok(state.collect_garbage()))? 318 .on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))?
319 .on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
320 .on_sync::<req::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
321 .on_sync::<req::SelectionRangeRequest>(|s, p| {
322 handlers::handle_selection_range(s.snapshot(), p)
323 })?
324 .on_sync::<req::FindMatchingBrace>(|s, p| {
325 handlers::handle_find_matching_brace(s.snapshot(), p)
326 })?
319 .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? 327 .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)?
320 .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? 328 .on::<req::SyntaxTree>(handlers::handle_syntax_tree)?
321 .on::<req::ExtendSelection>(handlers::handle_extend_selection)? 329 .on::<req::ExtendSelection>(handlers::handle_extend_selection)?
322 .on::<req::SelectionRangeRequest>(handlers::handle_selection_range)?
323 .on::<req::FindMatchingBrace>(handlers::handle_find_matching_brace)?
324 .on::<req::JoinLines>(handlers::handle_join_lines)?
325 .on::<req::OnEnter>(handlers::handle_on_enter)?
326 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? 330 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)?
327 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? 331 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)?
328 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? 332 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)?
@@ -428,6 +432,7 @@ struct PoolDispatcher<'a> {
428} 432}
429 433
430impl<'a> PoolDispatcher<'a> { 434impl<'a> PoolDispatcher<'a> {
435 /// Dispatches the request onto the current thread
431 fn on_sync<R>( 436 fn on_sync<R>(
432 &mut self, 437 &mut self,
433 f: fn(&mut ServerWorldState, R::Params) -> Result<R::Result>, 438 f: fn(&mut ServerWorldState, R::Params) -> Result<R::Result>,
@@ -449,6 +454,7 @@ impl<'a> PoolDispatcher<'a> {
449 Ok(self) 454 Ok(self)
450 } 455 }
451 456
457 /// Dispatches the request onto thread pool
452 fn on<R>(&mut self, f: fn(ServerWorld, R::Params) -> Result<R::Result>) -> Result<&mut Self> 458 fn on<R>(&mut self, f: fn(ServerWorld, R::Params) -> Result<R::Result>) -> Result<&mut Self>
453 where 459 where
454 R: req::Request + 'static, 460 R: req::Request + 'static,