Class: LSP::CodeActionContext

Inherits:
LSPBase
  • Object
show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface CodeActionContext

/**
 * An array of diagnostics known on the client side overlapping the range provided to the
 * `textDocument/codeAction` request. They are provied so that the server knows which
 * errors are currently presented to the user for the given range. There is no guarantee
 * that these accurately reflect the error state of the resource. The primary parameter
 * to compute code actions is the provided range.
 */
diagnostics: Diagnostic[];
/**
 * Requested kind of actions to return.
 *
 * Actions not of this kind are filtered out by the client before being shown. So servers
 * can omit computing them.
 */
only?: CodeActionKind[];

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ CodeActionContext

Returns a new instance of CodeActionContext.



1198
1199
1200
1201
# File 'lib/lsp/lsp_types.rb', line 1198

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[only]
end

Instance Attribute Details

#diagnosticsObject

type: Diagnostic[] # type: CodeActionKind[]



1196
1197
1198
# File 'lib/lsp/lsp_types.rb', line 1196

def diagnostics
  @diagnostics
end

#onlyObject

type: Diagnostic[] # type: CodeActionKind[]



1196
1197
1198
# File 'lib/lsp/lsp_types.rb', line 1196

def only
  @only
end

Instance Method Details

#from_h!(value) ⇒ Object



1203
1204
1205
1206
1207
1208
# File 'lib/lsp/lsp_types.rb', line 1203

def from_h!(value)
  value = {} if value.nil?
  self.diagnostics = to_typed_aray(value['diagnostics'], Diagnostic)
  self.only = value['only'].map { |val| val } unless value['only'].nil? # Unknown array type
  self
end