aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 19:03:35 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 19:03:35 +0000
commit4f4f7933b1b7ff34f8633b1686b18b2d1b994c47 (patch)
treea390d74ee5272a4a0070f5d4ea5281a04d4ba56a /crates/ra_lsp_server
parentc9e42fcf245be16958dca6571e4bccc6c29199df (diff)
parent921689b70da39160dd381e9716472827e36b03b8 (diff)
Merge #469
469: kill text utils r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs7
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::{
11use ra_analysis::{ 11use ra_analysis::{
12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, 12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange,
13}; 13};
14use ra_syntax::{text_utils::intersect, TextUnit, AstNode}; 14use ra_syntax::{TextUnit, AstNode};
15use ra_text_edit::text_utils::contains_offset_nonstrict;
16use rustc_hash::FxHashMap; 15use rustc_hash::FxHashMap;
17use serde_json::to_value; 16use serde_json::to_value;
18use std::io::Write; 17use 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();