diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 14 |
1 files changed, 14 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 | ||
80 | pub 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 | |||
80 | pub fn handle_on_type_formatting( | 94 | pub fn handle_on_type_formatting( |
81 | world: ServerWorld, | 95 | world: ServerWorld, |
82 | params: req::DocumentOnTypeFormattingParams, | 96 | params: req::DocumentOnTypeFormattingParams, |