diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | bors.toml | 2 | ||||
-rw-r--r-- | crates/ra_editor/src/extend_selection.rs | 17 |
4 files changed, 16 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index f8130a595..acf1af028 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -18,7 +18,7 @@ matrix: | |||
18 | node_js: node | 18 | node_js: node |
19 | before_script: false | 19 | before_script: false |
20 | script: | 20 | script: |
21 | - cd editors/code && npm ci && npm run travis; cd ../.. | 21 | - cd editors/code && npm ci && npm run travis |
22 | 22 | ||
23 | allow_failures: | 23 | allow_failures: |
24 | - rust nightly | 24 | - rust nightly |
@@ -1,7 +1,7 @@ | |||
1 | # Rust Analyzer | 1 | # Rust Analyzer |
2 | 2 | ||
3 | [![Build Status](https://travis-ci.org/rust-analyzer/rust-analyzer.svg?branch=master)](https://travis-ci.org/rust-analyzer/rust-analyzer) | 3 | [![Build Status](https://travis-ci.org/rust-analyzer/rust-analyzer.svg?branch=master)](https://travis-ci.org/rust-analyzer/rust-analyzer) |
4 | [![Build status](https://ci.appveyor.com/api/projects/status/j56x1hbje8rdg6xk/branch/master?svg=true)](https://ci.appveyor.com/project/rust-analyzer/rust-analyzer/branch/master) | 4 | [![Build status](https://ci.appveyor.com/api/projects/status/vtt455oi3hjy9uvk/branch/master?svg=true)](https://ci.appveyor.com/project/matklad/rust-analyzer/branch/master) |
5 | 5 | ||
6 | 6 | ||
7 | Rust Analyzer is an **experimental** modular compiler frontend for the | 7 | Rust Analyzer is an **experimental** modular compiler frontend for the |
@@ -1,5 +1,5 @@ | |||
1 | status = [ | 1 | status = [ |
2 | "continuous-integration/travis-ci/push", | 2 | "continuous-integration/travis-ci/push", |
3 | "continuous-integration/appveyor/branch" | 3 | # "continuous-integration/appveyor/branch" |
4 | ] | 4 | ] |
5 | delete_merged_branches = true | 5 | delete_merged_branches = true |
diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_editor/src/extend_selection.rs index e12346cb6..ab03a717e 100644 --- a/crates/ra_editor/src/extend_selection.rs +++ b/crates/ra_editor/src/extend_selection.rs | |||
@@ -43,17 +43,17 @@ pub(crate) fn extend(root: SyntaxNodeRef, range: TextRange) -> Option<TextRange> | |||
43 | } | 43 | } |
44 | 44 | ||
45 | fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Option<TextRange> { | 45 | fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Option<TextRange> { |
46 | let text : &str = leaf.leaf_text()?; | 46 | let text: &str = leaf.leaf_text()?; |
47 | let cursor_position: u32 = (offset - leaf.range().start()).into(); | 47 | let cursor_position: u32 = (offset - leaf.range().start()).into(); |
48 | 48 | ||
49 | let (before, after) = text.split_at(cursor_position as usize); | 49 | let (before, after) = text.split_at(cursor_position as usize); |
50 | let start_idx = before.rfind(char::is_whitespace)? as u32; | 50 | let start_idx = before.rfind(char::is_whitespace)? as u32; |
51 | let end_idx = after.find(char::is_whitespace)? as u32; | 51 | let end_idx = after.find(char::is_whitespace)? as u32; |
52 | 52 | ||
53 | let from : TextUnit = (start_idx + 1).into(); | 53 | let from: TextUnit = (start_idx + 1).into(); |
54 | let to : TextUnit = (cursor_position + end_idx).into(); | 54 | let to: TextUnit = (cursor_position + end_idx).into(); |
55 | 55 | ||
56 | Some(TextRange::from_to(from, to)) | 56 | Some(TextRange::from_to(from, to) + leaf.range().start()) |
57 | } | 57 | } |
58 | 58 | ||
59 | fn extend_ws(root: SyntaxNodeRef, ws: SyntaxNodeRef, offset: TextUnit) -> TextRange { | 59 | fn extend_ws(root: SyntaxNodeRef, ws: SyntaxNodeRef, offset: TextUnit) -> TextRange { |
@@ -219,5 +219,14 @@ fn main() { foo+<|>bar;} | |||
219 | r#"// foo bar b<|>az quxx"#, | 219 | r#"// foo bar b<|>az quxx"#, |
220 | &["baz", "// foo bar baz quxx"] | 220 | &["baz", "// foo bar baz quxx"] |
221 | ); | 221 | ); |
222 | do_check(r#" | ||
223 | impl S { | ||
224 | fn foo() { | ||
225 | // hel<|>lo world | ||
226 | } | ||
227 | } | ||
228 | "#, | ||
229 | &["hello", "// hello world"] | ||
230 | ); | ||
222 | } | 231 | } |
223 | } | 232 | } |