aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-03 14:39:30 +0100
committerGitHub <[email protected]>2020-06-03 14:39:30 +0100
commita33cfcb55db4fafc873c0ce6d508cb27d6531cb6 (patch)
treef3c5655ecc9efc42b89954530210f4871a16d941
parent1edf6d2d4fe613b43796554d9765056183efe21a (diff)
parent9e71fc0314a2555eda446a64057df7e8f78fb7c9 (diff)
Merge #4502
4502: Mark fixes from diagnostics as quick fixes r=kjeremy a=kjeremy Populates the diagnostic UI with fixes: Before: ![quickfix-before](https://user-images.githubusercontent.com/4325700/82165183-0e38df00-9882-11ea-96cf-7dab5faec4d4.PNG) After: ![image](https://user-images.githubusercontent.com/4325700/82165193-1a24a100-9882-11ea-97d7-be1b64b135e0.png) Co-authored-by: Jeremy Kolb <[email protected]>
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs9
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/main.rs2
2 files changed, 9 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index 1bb8e4473..c2a5bf4d6 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -730,8 +730,13 @@ pub fn handle_code_action(
730 for fix in fixes_from_diagnostics { 730 for fix in fixes_from_diagnostics {
731 let title = fix.label; 731 let title = fix.label;
732 let edit = to_proto::snippet_workspace_edit(&snap, fix.source_change)?; 732 let edit = to_proto::snippet_workspace_edit(&snap, fix.source_change)?;
733 let action = 733 let action = lsp_ext::CodeAction {
734 lsp_ext::CodeAction { title, group: None, kind: None, edit: Some(edit), command: None }; 734 title,
735 group: None,
736 kind: Some(lsp_types::code_action_kind::QUICKFIX.into()),
737 edit: Some(edit),
738 command: None,
739 };
735 res.push(action); 740 res.push(action);
736 } 741 }
737 742
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs
index c1805787a..ad3476310 100644
--- a/crates/rust-analyzer/tests/heavy_tests/main.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/main.rs
@@ -298,6 +298,7 @@ fn main() {}
298 } 298 }
299 ] 299 ]
300 }, 300 },
301 "kind": "quickfix",
301 "title": "Create module" 302 "title": "Create module"
302 }]), 303 }]),
303 ); 304 );
@@ -368,6 +369,7 @@ fn main() {{}}
368 } 369 }
369 ] 370 ]
370 }, 371 },
372 "kind": "quickfix",
371 "title": "Create module" 373 "title": "Create module"
372 }]), 374 }]),
373 ); 375 );