Class: LSP::CodeAction
Overview
export interface CodeAction
/**
* A short, human-readable, title for this code action.
*/
title: string;
/**
* The kind of the code action.
*
* Used to filter code actions.
*/
kind?: CodeActionKind;
/**
* The diagnostics that this code action resolves.
*/
diagnostics?: Diagnostic[];
/**
* 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
*/
isPreferred?: boolean;
/**
* The workspace edit this code action performs.
*/
edit?: WorkspaceEdit;
/**
* A command this code action executes. If a code action
* provides a edit and a command, first the edit is
* executed and then the command.
*/
command?: Command;
Instance Attribute Summary collapse
-
#command ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
-
#diagnostics ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
-
#edit ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
-
#isPreferred ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
-
#kind ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
-
#title ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command.
Instance Method Summary collapse
- #from_h!(value) ⇒ Object
-
#initialize(initial_hash = nil) ⇒ CodeAction
constructor
A new instance of CodeAction.
Methods inherited from LSPBase
Constructor Details
#initialize(initial_hash = nil) ⇒ CodeAction
Returns a new instance of CodeAction.
1250 1251 1252 1253 |
# File 'lib/lsp/lsp_types.rb', line 1250 def initialize(initial_hash = nil) super @optional_method_names = i[kind diagnostics isPreferred edit command] end |
Instance Attribute Details
#command ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def command @command end |
#diagnostics ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def diagnostics @diagnostics end |
#edit ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def edit @edit end |
#isPreferred ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def isPreferred @isPreferred end |
#kind ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def kind @kind end |
#title ⇒ Object
type: string # type: CodeActionKind # type: Diagnostic[] # type: boolean # type: WorkspaceEdit # type: Command
1248 1249 1250 |
# File 'lib/lsp/lsp_types.rb', line 1248 def title @title end |
Instance Method Details
#from_h!(value) ⇒ Object
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'lib/lsp/lsp_types.rb', line 1255 def from_h!(value) value = {} if value.nil? self.title = value['title'] self.kind = value['kind'] # Unknown type self.diagnostics = to_typed_aray(value['diagnostics'], Diagnostic) self.isPreferred = value['isPreferred'] # Unknown type self.edit = WorkspaceEdit.new(value['edit']) unless value['edit'].nil? self.command = Command.new(value['command']) unless value['command'].nil? self end |