aboutsummaryrefslogtreecommitdiff
path: root/crates/libeditor/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libeditor/src')
-rw-r--r--crates/libeditor/src/extend_selection.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/crates/libeditor/src/extend_selection.rs b/crates/libeditor/src/extend_selection.rs
index 171e40692..32873f491 100644
--- a/crates/libeditor/src/extend_selection.rs
+++ b/crates/libeditor/src/extend_selection.rs
@@ -17,18 +17,14 @@ pub(crate) fn extend(root: SyntaxNodeRef, range: TextRange) -> Option<TextRange>
17 return Some(leaf.range()); 17 return Some(leaf.range());
18 } 18 }
19 let ws = leaves.next()?; 19 let ws = leaves.next()?;
20// let ws_suffix = file.text().slice( 20 let ws_text = ws.leaf_text().unwrap();
21// TextRange::from_to(offset, ws.range().end()) 21 let range = TextRange::from_to(offset, ws.range().end()) - ws.range().start();
22// ); 22 let ws_suffix = &ws_text.as_str()[range];
23// if ws.text().contains("\n") && !ws_suffix.contains("\n") { 23 if ws_text.contains("\n") && !ws_suffix.contains("\n") {
24// if let Some(line_end) = file.text() 24 if let Some(node) = ws.next_sibling() {
25// .slice(TextSuffix::from(ws.range().end())) 25 return Some(node.range());
26// .find("\n") 26 }
27// { 27 }
28// let range = TextRange::from_len(ws.range().end(), line_end);
29// return Some(find_covering_node(file.root(), range).range());
30// }
31// }
32 return Some(ws.range()); 28 return Some(ws.range());
33 }; 29 };
34 let node = find_covering_node(root, range); 30 let node = find_covering_node(root, range);