diff options
author | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 18:50:04 +0000 |
commit | f553837c1ca30a52bf5091689c21d3c3e3362395 (patch) | |
tree | 79dbabf6137e6aaf64d494f57a7cecbf397237bc /crates/ra_lsp_server/src/main_loop/handlers.rs | |
parent | c9e42fcf245be16958dca6571e4bccc6c29199df (diff) |
upstream text-utils to text_unit
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index b9b42f1b3..b7777bfc3 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -11,8 +11,7 @@ use languageserver_types::{ | |||
11 | use ra_analysis::{ | 11 | use ra_analysis::{ |
12 | FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, | 12 | FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, |
13 | }; | 13 | }; |
14 | use ra_syntax::{text_utils::intersect, TextUnit, AstNode}; | 14 | use ra_syntax::{TextUnit, AstNode}; |
15 | use ra_text_edit::text_utils::contains_offset_nonstrict; | ||
16 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
17 | use serde_json::to_value; | 16 | use serde_json::to_value; |
18 | use std::io::Write; | 17 | use std::io::Write; |
@@ -248,7 +247,7 @@ pub fn handle_runnables( | |||
248 | let mut res = Vec::new(); | 247 | let mut res = Vec::new(); |
249 | for runnable in world.analysis().runnables(file_id)? { | 248 | for runnable in world.analysis().runnables(file_id)? { |
250 | if let Some(offset) = offset { | 249 | if let Some(offset) = offset { |
251 | if !contains_offset_nonstrict(runnable.range, offset) { | 250 | if !runnable.range.contains_inclusive(offset) { |
252 | continue; | 251 | continue; |
253 | } | 252 | } |
254 | } | 253 | } |
@@ -650,7 +649,7 @@ pub fn handle_code_action( | |||
650 | .diagnostics(file_id)? | 649 | .diagnostics(file_id)? |
651 | .into_iter() | 650 | .into_iter() |
652 | .filter_map(|d| Some((d.range, d.fix?))) | 651 | .filter_map(|d| Some((d.range, d.fix?))) |
653 | .filter(|(diag_range, _fix)| intersect(*diag_range, range).is_some()) | 652 | .filter(|(diag_range, _fix)| diag_range.intersection(&range).is_some()) |
654 | .map(|(_range, fix)| fix); | 653 | .map(|(_range, fix)| fix); |
655 | 654 | ||
656 | let mut res = Vec::new(); | 655 | let mut res = Vec::new(); |