diff options
author | Florian Diebold <[email protected]> | 2018-12-02 19:58:16 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-02 19:58:16 +0000 |
commit | d0811c4066c90b03532860c93d2a14248240b2a0 (patch) | |
tree | 1902ac61c78df68d2224bc4728e7342a1d5847cc /crates | |
parent | 0bdf8deb77e9066baa42acb98c99e9fc54e90634 (diff) |
Fix diagnostic fixes showing up everywhere
The LSP code action request always returned the fixes for all diagnostics
anywhere in the file, because of a shadowed variable.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 6d5622b15..af21254e4 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -9,7 +9,7 @@ use languageserver_types::{ | |||
9 | WorkspaceEdit, ParameterInformation, SignatureInformation, Hover, HoverContents, | 9 | WorkspaceEdit, ParameterInformation, SignatureInformation, Hover, HoverContents, |
10 | }; | 10 | }; |
11 | use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition}; | 11 | use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition}; |
12 | use ra_syntax::{TextUnit, text_utils::contains_offset_nonstrict}; | 12 | use ra_syntax::{TextUnit, text_utils::{contains_offset_nonstrict, intersect}}; |
13 | use rustc_hash::FxHashMap; | 13 | use rustc_hash::FxHashMap; |
14 | use serde_json::to_value; | 14 | use serde_json::to_value; |
15 | 15 | ||
@@ -618,7 +618,7 @@ pub fn handle_code_action( | |||
618 | .diagnostics(file_id)? | 618 | .diagnostics(file_id)? |
619 | .into_iter() | 619 | .into_iter() |
620 | .filter_map(|d| Some((d.range, d.fix?))) | 620 | .filter_map(|d| Some((d.range, d.fix?))) |
621 | .filter(|(range, _fix)| contains_offset_nonstrict(*range, range.start())) | 621 | .filter(|(diag_range, _fix)| intersect(*diag_range, range).is_some()) |
622 | .map(|(_range, fix)| fix); | 622 | .map(|(_range, fix)| fix); |
623 | 623 | ||
624 | let mut res = Vec::new(); | 624 | let mut res = Vec::new(); |