struct LSP::CodeAction
- LSP::CodeAction
- Struct
- Value
- Object
Overview
Code Action options.
Included Modules
- JSON::Serializable
Defined in:
lsp/protocol/code_action.crConstructors
- .new(title : String, kind : Nil | String, edit : LSP::WorkspaceEdit | Nil, diagnostics : Nil | Array(LSP::Diagnostic) = [] of Diagnostic, is_preferred : Bool | Nil = false, disabled : LSP::CodeAction::Disabled | Nil = nil, command : LSP::Command | Nil = nil, data : Nil | String = nil)
- .new(pull : JSON::PullParser)
Instance Method Summary
-
#command : Command | Nil
A command this code action executes.
-
#command=(command : Command | Nil)
A command this code action executes.
-
#data : String | Nil
A data entry field that is preserved on a code action between a
textDocument/codeAction
and acodeAction/resolve
request. -
#data=(data : String | Nil)
A data entry field that is preserved on a code action between a
textDocument/codeAction
and acodeAction/resolve
request. -
#diagnostics : Array(Diagnostic) | Nil
The diagnostics that this code action resolves.
-
#diagnostics=(diagnostics : Array(Diagnostic) | Nil)
The diagnostics that this code action resolves.
-
#disabled : Disabled | Nil
Marks that the code action cannot currently be applied.
-
#disabled=(disabled : Disabled | Nil)
Marks that the code action cannot currently be applied.
-
#edit : WorkspaceEdit | Nil
The workspace edit this code action performs.
-
#edit=(edit : WorkspaceEdit | Nil)
The workspace edit this code action performs.
-
#is_preferred : Bool | Nil
Marks this as a preferred action.
-
#is_preferred=(is_preferred : Bool | Nil)
Marks this as a preferred action.
-
#kind : String | Nil
The kind of the code action.
-
#kind=(kind : String | Nil)
The kind of the code action.
-
#title : String
A short, human-readable, title for this code action.
-
#title=(title : String)
A short, human-readable, title for this code action.
Constructor Detail
Instance Method Detail
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.
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.
A data entry field that is preserved on a code action between
a textDocument/codeAction
and a codeAction/resolve
request.
@since 3.16.0
A data entry field that is preserved on a code action between
a textDocument/codeAction
and a codeAction/resolve
request.
@since 3.16.0
The diagnostics that this code action resolves.
The diagnostics that this code action resolves.
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
reason
in the editor.
@since 3.16.0
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
reason
in the editor.
@since 3.16.0
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
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
The kind of the code action.
Used to filter code actions.