mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
make typing infra slightly more extensible
This commit is contained in:
parent
518f99e16b
commit
8d2fd59cfb
3 changed files with 74 additions and 54 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue