be more careful with adding semis

This commit is contained in:
Aleksey Kladov 2018-08-28 21:45:59 +03:00
parent f5de8212da
commit e6ab53619b
2 changed files with 9 additions and 0 deletions

View file

@ -65,6 +65,9 @@ pub fn on_eq_typed(file: &File, offset: TextUnit) -> Option<ActionResult> {
if contains_offset_nonstrict(expr_range, offset) && offset != expr_range.start() {
return None;
}
if file.syntax().text().slice(offset..expr_range.start()).contains('\n') {
return None;
}
} else {
return None;
}

View file

@ -99,3 +99,9 @@ impl SyntaxTextSlice for ops::RangeFrom<TextUnit> {
Some(TextRange::from_to(self.start, range.end()))
}
}
impl SyntaxTextSlice for ops::Range<TextUnit> {
fn restrict(&self, range: TextRange) -> Option<TextRange> {
TextRange::from_to(self.start, self.end).restrict(range)
}
}