aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-10-09 14:00:20 +0100
committerAleksey Kladov <[email protected]>2018-10-09 17:52:06 +0100
commit2b956fd3a83313cee37ff179eae843bc88dd572a (patch)
treea1010728cfc8018e5f62152f4c45b9523f8d5e25 /crates/ra_lsp_server/src/main_loop/handlers.rs
parent82447ecacef9129a44d3c17b3db7a0e60a7ec92b (diff)
Add on-enter handler
Now, typing doc comments is much more pleasant
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs14
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
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,