mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #5327
5327: Mark fixes from check as preferred r=matklad a=kjeremy This allows us to run the auto fix command from vscode to automatically fix diagnostics in the file. They are also distinguished in the UI. Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
This commit is contained in:
commit
2ca0e9e00e
9 changed files with 20 additions and 0 deletions
|
@ -118,6 +118,7 @@ fn map_rust_child_diagnostic(
|
|||
changes: Some(edit_map),
|
||||
document_changes: None,
|
||||
}),
|
||||
is_preferred: Some(true),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -770,6 +770,7 @@ fn handle_fixes(
|
|||
group: None,
|
||||
kind: Some(CodeActionKind::QUICKFIX),
|
||||
edit: Some(edit),
|
||||
is_preferred: Some(false),
|
||||
};
|
||||
res.push(action);
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ impl Request for CodeActionRequest {
|
|||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CodeAction {
|
||||
pub title: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -256,6 +257,8 @@ pub struct CodeAction {
|
|||
// pub command: Option<lsp_types::Command>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub edit: Option<SnippetWorkspaceEdit>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub is_preferred: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
|
||||
|
|
|
@ -689,6 +689,7 @@ pub(crate) fn unresolved_code_action(
|
|||
group: assist.group.filter(|_| snap.config.client_caps.code_action_group).map(|gr| gr.0),
|
||||
kind: Some(code_action_kind(assist.id.1)),
|
||||
edit: None,
|
||||
is_preferred: None,
|
||||
};
|
||||
Ok(res)
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
document_changes: None,
|
||||
},
|
||||
),
|
||||
is_preferred: Some(
|
||||
true,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -284,6 +284,7 @@ fn main() {}
|
|||
}
|
||||
]
|
||||
},
|
||||
"isPreferred": false,
|
||||
"kind": "quickfix",
|
||||
"title": "Create module"
|
||||
}]),
|
||||
|
@ -355,6 +356,7 @@ fn main() {{}}
|
|||
}
|
||||
]
|
||||
},
|
||||
"isPreferred": false,
|
||||
"kind": "quickfix",
|
||||
"title": "Create module"
|
||||
}]),
|
||||
|
|
Loading…
Reference in a new issue