aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs14
-rw-r--r--crates/ra_lsp_server/src/main_loop/mod.rs1
2 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 79a54183e..725036cc7 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -77,6 +77,20 @@ pub fn handle_join_lines(
77 .try_conv_with(&world) 77 .try_conv_with(&world)
78} 78}
79 79
80pub fn handle_on_enter(
81 world: ServerWorld,
82 params: req::TextDocumentPositionParams,
83 _token: JobToken,
84) -> Result<Option<req::SourceChange>> {
85 let file_id = params.text_document.try_conv_with(&world)?;
86 let line_index = world.analysis().file_line_index(file_id);
87 let offset = params.position.conv_with(&line_index);
88 match world.analysis().on_enter(file_id, offset) {
89 None => Ok(None),
90 Some(edit) => Ok(Some(edit.try_conv_with(&world)?))
91 }
92}
93
80pub fn handle_on_type_formatting( 94pub fn handle_on_type_formatting(
81 world: ServerWorld, 95 world: ServerWorld,
82 params: req::DocumentOnTypeFormattingParams, 96 params: req::DocumentOnTypeFormattingParams,
diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs
index 47a9b202e..53c6f1dff 100644
--- a/crates/ra_lsp_server/src/main_loop/mod.rs
+++ b/crates/ra_lsp_server/src/main_loop/mod.rs
@@ -244,6 +244,7 @@ fn on_request(
244 .on::<req::ExtendSelection>(handlers::handle_extend_selection)? 244 .on::<req::ExtendSelection>(handlers::handle_extend_selection)?
245 .on::<req::FindMatchingBrace>(handlers::handle_find_matching_brace)? 245 .on::<req::FindMatchingBrace>(handlers::handle_find_matching_brace)?
246 .on::<req::JoinLines>(handlers::handle_join_lines)? 246 .on::<req::JoinLines>(handlers::handle_join_lines)?
247 .on::<req::OnEnter>(handlers::handle_on_enter)?
247 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? 248 .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)?
248 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? 249 .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)?
249 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? 250 .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)?