diff options
author | Aleksey Kladov <[email protected]> | 2021-04-12 15:58:01 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-04-12 15:58:01 +0100 |
commit | 426d098bd6a032cb03e61d4b3d091caeaecbd4d0 (patch) | |
tree | eb54a5d4e72a875b072af5f266673c6265057f3d /crates/rust-analyzer/src/handlers.rs | |
parent | cae920a1bb827726aa142e5c81da9e6b0ca38d97 (diff) |
internal: prepare for lazy diagnostics
Diffstat (limited to 'crates/rust-analyzer/src/handlers.rs')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index edfa42eb5..107685c63 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -1039,18 +1039,20 @@ fn add_quick_fixes( | |||
1039 | for fix in diagnostics | 1039 | for fix in diagnostics |
1040 | .into_iter() | 1040 | .into_iter() |
1041 | .filter_map(|d| d.fix) | 1041 | .filter_map(|d| d.fix) |
1042 | .filter(|fix| fix.fix_trigger_range.intersect(frange.range).is_some()) | 1042 | .filter(|fix| fix.target.intersect(frange.range).is_some()) |
1043 | { | 1043 | { |
1044 | let edit = to_proto::snippet_workspace_edit(&snap, fix.source_change)?; | 1044 | if let Some(source_change) = fix.source_change { |
1045 | let action = lsp_ext::CodeAction { | 1045 | let edit = to_proto::snippet_workspace_edit(&snap, source_change)?; |
1046 | title: fix.label.to_string(), | 1046 | let action = lsp_ext::CodeAction { |
1047 | group: None, | 1047 | title: fix.label.to_string(), |
1048 | kind: Some(CodeActionKind::QUICKFIX), | 1048 | group: None, |
1049 | edit: Some(edit), | 1049 | kind: Some(CodeActionKind::QUICKFIX), |
1050 | is_preferred: Some(false), | 1050 | edit: Some(edit), |
1051 | data: None, | 1051 | is_preferred: Some(false), |
1052 | }; | 1052 | data: None, |
1053 | acc.push(action); | 1053 | }; |
1054 | acc.push(action); | ||
1055 | } | ||
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | for fix in snap.check_fixes.get(&frange.file_id).into_iter().flatten() { | 1058 | for fix in snap.check_fixes.get(&frange.file_id).into_iter().flatten() { |