aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs1
-rw-r--r--crates/rust-analyzer/src/handlers.rs1
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs3
-rw-r--r--crates/rust-analyzer/src/to_proto.rs1
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable.txt3
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt3
-rw-r--r--crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt3
-rw-r--r--crates/rust-analyzer/test_data/snap_multi_line_fix.txt3
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/main.rs2
9 files changed, 20 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index 7be3ef984..97f331352 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -118,6 +118,7 @@ fn map_rust_child_diagnostic(
118 changes: Some(edit_map), 118 changes: Some(edit_map),
119 document_changes: None, 119 document_changes: None,
120 }), 120 }),
121 is_preferred: Some(true),
121 }) 122 })
122 } 123 }
123} 124}
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index d28c700f1..42f21289a 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -775,6 +775,7 @@ fn handle_fixes(
775 group: None, 775 group: None,
776 kind: Some(CodeActionKind::QUICKFIX), 776 kind: Some(CodeActionKind::QUICKFIX),
777 edit: Some(edit), 777 edit: Some(edit),
778 is_preferred: Some(false),
778 }; 779 };
779 res.push(action); 780 res.push(action);
780 } 781 }
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs
index e216966a9..13ebb18fb 100644
--- a/crates/rust-analyzer/src/lsp_ext.rs
+++ b/crates/rust-analyzer/src/lsp_ext.rs
@@ -243,6 +243,7 @@ impl Request for CodeActionRequest {
243} 243}
244 244
245#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] 245#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
246#[serde(rename_all = "camelCase")]
246pub struct CodeAction { 247pub struct CodeAction {
247 pub title: String, 248 pub title: String,
248 #[serde(skip_serializing_if = "Option::is_none")] 249 #[serde(skip_serializing_if = "Option::is_none")]
@@ -256,6 +257,8 @@ pub struct CodeAction {
256 // pub command: Option<lsp_types::Command>, 257 // pub command: Option<lsp_types::Command>,
257 #[serde(skip_serializing_if = "Option::is_none")] 258 #[serde(skip_serializing_if = "Option::is_none")]
258 pub edit: Option<SnippetWorkspaceEdit>, 259 pub edit: Option<SnippetWorkspaceEdit>,
260 #[serde(skip_serializing_if = "Option::is_none")]
261 pub is_preferred: Option<bool>,
259} 262}
260 263
261#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] 264#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 2fcae9ca3..e60537fcd 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -652,6 +652,7 @@ pub(crate) fn unresolved_code_action(
652 group: assist.group.filter(|_| snap.config.client_caps.code_action_group).map(|gr| gr.0), 652 group: assist.group.filter(|_| snap.config.client_caps.code_action_group).map(|gr| gr.0),
653 kind: Some(code_action_kind(assist.id.1)), 653 kind: Some(code_action_kind(assist.id.1)),
654 edit: None, 654 edit: None,
655 is_preferred: None,
655 }; 656 };
656 Ok(res) 657 Ok(res)
657} 658}
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/test_data/rustc_unused_variable.txt
index 084632757..74d91bc77 100644
--- a/crates/rust-analyzer/test_data/rustc_unused_variable.txt
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable.txt
@@ -65,6 +65,9 @@
65 document_changes: None, 65 document_changes: None,
66 }, 66 },
67 ), 67 ),
68 is_preferred: Some(
69 true,
70 ),
68 }, 71 },
69 ], 72 ],
70 }, 73 },
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt
index d637923c5..8a420c949 100644
--- a/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt
@@ -65,6 +65,9 @@
65 document_changes: None, 65 document_changes: None,
66 }, 66 },
67 ), 67 ),
68 is_preferred: Some(
69 true,
70 ),
68 }, 71 },
69 ], 72 ],
70 }, 73 },
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt
index 6b48f16ed..79910660b 100644
--- a/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt
+++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt
@@ -65,6 +65,9 @@
65 document_changes: None, 65 document_changes: None,
66 }, 66 },
67 ), 67 ),
68 is_preferred: Some(
69 true,
70 ),
68 }, 71 },
69 ], 72 ],
70 }, 73 },
diff --git a/crates/rust-analyzer/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt
index 2c4cbea16..4f811ab64 100644
--- a/crates/rust-analyzer/test_data/snap_multi_line_fix.txt
+++ b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt
@@ -93,6 +93,9 @@
93 document_changes: None, 93 document_changes: None,
94 }, 94 },
95 ), 95 ),
96 is_preferred: Some(
97 true,
98 ),
96 }, 99 },
97 ], 100 ],
98 }, 101 },
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs
index 7b908d30c..f12e5a37f 100644
--- a/crates/rust-analyzer/tests/heavy_tests/main.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/main.rs
@@ -284,6 +284,7 @@ fn main() {}
284 } 284 }
285 ] 285 ]
286 }, 286 },
287 "isPreferred": false,
287 "kind": "quickfix", 288 "kind": "quickfix",
288 "title": "Create module" 289 "title": "Create module"
289 }]), 290 }]),
@@ -355,6 +356,7 @@ fn main() {{}}
355 } 356 }
356 ] 357 ]
357 }, 358 },
359 "isPreferred": false,
358 "kind": "quickfix", 360 "kind": "quickfix",
359 "title": "Create module" 361 "title": "Create module"
360 }]), 362 }]),