aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-25 11:03:57 +0100
committerAleksey Kladov <[email protected]>2019-10-25 11:03:57 +0100
commitd5cd8b5be2a146abe75c0aa322f2313240c8f23c (patch)
tree87a6a4d0aec36879f6984dad822d97d740c72bd6
parent53e3bee0cfcd7541b5ee882ab4b47c9dde9780b8 (diff)
disable the new typing handler for `->`
It doesn't actually work with LSP
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs9
1 files changed, 9 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 6f1e59b4b..16fb07266 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -146,6 +146,15 @@ pub fn handle_on_type_formatting(
146 // `text.char_at(position) == typed_char`. 146 // `text.char_at(position) == typed_char`.
147 position.offset = position.offset - TextUnit::of_char('.'); 147 position.offset = position.offset - TextUnit::of_char('.');
148 let char_typed = params.ch.chars().next().unwrap_or('\0'); 148 let char_typed = params.ch.chars().next().unwrap_or('\0');
149
150 // We have an assist that inserts ` ` after typing `->` in `fn foo() ->{`,
151 // but it requires precise cursor positioning to work, and one can't
152 // position the cursor with on_type formatting. So, let's just toggle this
153 // feature off here, hoping that we'll enable it one day, 😿.
154 if char_typed == '>' {
155 return Ok(None);
156 }
157
149 let edit = world.analysis().on_char_typed(position, char_typed)?; 158 let edit = world.analysis().on_char_typed(position, char_typed)?;
150 let mut edit = match edit { 159 let mut edit = match edit {
151 Some(it) => it, 160 Some(it) => it,