From 8d2fd59cfb00211573419b0a59cf91d92d636f5a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Oct 2019 11:19:26 +0300 Subject: make typing infra slightly more extensible --- crates/ra_lsp_server/src/main_loop/handlers.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index a29971d10..530c4d8b6 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -144,12 +144,8 @@ pub fn handle_on_type_formatting( // in `ra_ide_api`, the `on_type` invariant is that // `text.char_at(position) == typed_char`. position.offset = position.offset - TextUnit::of_char('.'); - - let edit = match params.ch.as_str() { - "=" => world.analysis().on_eq_typed(position), - "." => world.analysis().on_dot_typed(position), - _ => return Ok(None), - }?; + let char_typed = params.ch.chars().next().unwrap_or('\0'); + let edit = world.analysis().on_char_typed(position, char_typed)?; let mut edit = match edit { Some(it) => it, None => return Ok(None), -- cgit v1.2.3