mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
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.
This commit is contained in:
parent
0bdf8deb77
commit
d0811c4066
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ use languageserver_types::{
|
||||||
WorkspaceEdit, ParameterInformation, SignatureInformation, Hover, HoverContents,
|
WorkspaceEdit, ParameterInformation, SignatureInformation, Hover, HoverContents,
|
||||||
};
|
};
|
||||||
use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition};
|
use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition};
|
||||||
use ra_syntax::{TextUnit, text_utils::contains_offset_nonstrict};
|
use ra_syntax::{TextUnit, text_utils::{contains_offset_nonstrict, intersect}};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use serde_json::to_value;
|
use serde_json::to_value;
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ pub fn handle_code_action(
|
||||||
.diagnostics(file_id)?
|
.diagnostics(file_id)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|d| Some((d.range, d.fix?)))
|
.filter_map(|d| Some((d.range, d.fix?)))
|
||||||
.filter(|(range, _fix)| contains_offset_nonstrict(*range, range.start()))
|
.filter(|(diag_range, _fix)| intersect(*diag_range, range).is_some())
|
||||||
.map(|(_range, fix)| fix);
|
.map(|(_range, fix)| fix);
|
||||||
|
|
||||||
let mut res = Vec::new();
|
let mut res = Vec::new();
|
||||||
|
|
Loading…
Reference in a new issue