Struct lsp_types::CodeAction

source ·
pub struct CodeAction {
    pub title: String,
    pub kind: Option<CodeActionKind>,
    pub diagnostics: Option<Vec<Diagnostic>>,
    pub edit: Option<WorkspaceEdit>,
    pub command: Option<Command>,
    pub is_preferred: Option<bool>,
    pub disabled: Option<CodeActionDisabled>,
    pub data: Option<Value>,
}

Fields§

§title: String

A short, human-readable, title for this code action.

§kind: Option<CodeActionKind>

The kind of the code action. Used to filter code actions.

§diagnostics: Option<Vec<Diagnostic>>

The diagnostics that this code action resolves.

§edit: Option<WorkspaceEdit>

The workspace edit this code action performs.

§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.

§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.

@since 3.15.0

§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 lightbulb code action menu.

  • 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 reason in the editor.

@since 3.16.0

§data: Option<Value>

A data entry field that is preserved on a code action between a textDocument/codeAction and a codeAction/resolve request.

@since 3.16.0

Trait Implementations§

source§

impl Clone for CodeAction

source§

fn clone(&self) -> CodeAction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CodeAction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CodeAction

source§

fn default() -> CodeAction

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for CodeAction

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<CodeAction> for CodeActionOrCommand

source§

fn from(action: CodeAction) -> Self

Converts to this type from the input type.
source§

impl PartialEq for CodeAction

source§

fn eq(&self, other: &CodeAction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for CodeAction

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for CodeAction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,