mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
be more careful with adding semis
This commit is contained in:
parent
f5de8212da
commit
e6ab53619b
2 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue