pub struct CodeAction {
pub command: Option<Command>,
pub data: Option<Value>,
pub diagnostics: Option<Vec<Diagnostic>>,
pub disabled: Option<CodeActionDisabled>,
pub edit: Option<WorkspaceEdit>,
pub is_preferred: Option<bool>,
pub kind: Option<CodeActionKind>,
pub title: String,
}Expand description
A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.
A CodeAction must set either edit and/or a command. If both are supplied, the edit is
applied first, then the command is executed.
Fields§
§command: Option<Command>A command this code action executes. If a code action provides an edit and a command, first the edit is executed and then the command.
data: Option<Value>A data entry field that is preserved on a code action between a textDocument/codeAction
and a codeAction/resolve request.
diagnostics: Option<Vec<Diagnostic>>The diagnostics that this code action resolves.
disabled: Option<CodeActionDisabled>Marks that the code action cannot currently be applied.
Clients should follow the following guidelines regarding disabled code actions:
-
Disabled code actions are not shown in automatic lightbulbs code action menus.
-
Disabled actions are shown as faded out in the code action menu when the user request a more specific type of code action, such as refactorings.
-
If the user has a keybinding that auto applies a code action and only a disabled code actions are returned, the client should show the user an error message with
reasonin the editor.
edit: Option<WorkspaceEdit>The workspace edit this code action performs.
is_preferred: Option<bool>Marks this as a preferred action. Preferred actions are used by the auto fix command and
can be targeted by keybindings.
A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
kind: Option<CodeActionKind>The kind of the code action.
Used to filter code actions.
title: StringA short, human-readable, title for this code action.
Implementations§
Source§impl CodeAction
impl CodeAction
Sourcepub fn ret(result: CodeAction) -> CodeAction
pub fn ret(result: CodeAction) -> CodeAction
helper function for user do not need to remember result type of a request
Trait Implementations§
Source§impl Clone for CodeAction
impl Clone for CodeAction
Source§fn clone(&self) -> CodeAction
fn clone(&self) -> CodeAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodeAction
impl Debug for CodeAction
Source§impl Default for CodeAction
impl Default for CodeAction
Source§fn default() -> CodeAction
fn default() -> CodeAction
Source§impl<'de> Deserialize<'de> for CodeAction
impl<'de> Deserialize<'de> for CodeAction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromReq for CodeAction
impl FromReq for CodeAction
const METHOD: &'static str = "codeAction/resolve"
type Ret = CodeAction
Source§fn from_req(req: RequestMessage) -> OneOf<(ReqId, Self), RequestMessage>
fn from_req(req: RequestMessage) -> OneOf<(ReqId, Self), RequestMessage>
OneOf::Other(request)