aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/libeditor/src/typing.rs3
-rw-r--r--crates/libsyntax2/src/yellow/syntax_text.rs6
2 files changed, 9 insertions, 0 deletions
diff --git a/crates/libeditor/src/typing.rs b/crates/libeditor/src/typing.rs
index 952caf7f6..65a8933a4 100644
--- a/crates/libeditor/src/typing.rs
+++ b/crates/libeditor/src/typing.rs
@@ -65,6 +65,9 @@ pub fn on_eq_typed(file: &File, offset: TextUnit) -> Option<ActionResult> {
65 if contains_offset_nonstrict(expr_range, offset) && offset != expr_range.start() { 65 if contains_offset_nonstrict(expr_range, offset) && offset != expr_range.start() {
66 return None; 66 return None;
67 } 67 }
68 if file.syntax().text().slice(offset..expr_range.start()).contains('\n') {
69 return None;
70 }
68 } else { 71 } else {
69 return None; 72 return None;
70 } 73 }
diff --git a/crates/libsyntax2/src/yellow/syntax_text.rs b/crates/libsyntax2/src/yellow/syntax_text.rs
index 268547470..d299fd700 100644
--- a/crates/libsyntax2/src/yellow/syntax_text.rs
+++ b/crates/libsyntax2/src/yellow/syntax_text.rs
@@ -99,3 +99,9 @@ impl SyntaxTextSlice for ops::RangeFrom<TextUnit> {
99 Some(TextRange::from_to(self.start, range.end())) 99 Some(TextRange::from_to(self.start, range.end()))
100 } 100 }
101} 101}
102
103impl SyntaxTextSlice for ops::Range<TextUnit> {
104 fn restrict(&self, range: TextRange) -> Option<TextRange> {
105 TextRange::from_to(self.start, self.end).restrict(range)
106 }
107}