Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix diagnostic fixes showing up everywhere #253

Merged
merged 1 commit into from
Dec 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/ra_lsp_server/src/main_loop/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use languageserver_types::{
WorkspaceEdit, ParameterInformation, SignatureInformation, Hover, HoverContents,
};
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 serde_json::to_value;

Expand Down Expand Up @@ -618,7 +618,7 @@ pub fn handle_code_action(
.diagnostics(file_id)?
.into_iter()
.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);

let mut res = Vec::new();
Expand Down