Class: LanguageServer::Protocol::Interface::CodeActionParams

Inherits:
PartialResultParams show all
Defined in:
lib/language_server/protocol/interface/code_action_params.rb

Overview

Params for the CodeActionRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PartialResultParams

#partial_result_token

Constructor Details

#initialize(partial_result_token: nil, text_document:, range:, context:) ⇒ CodeActionParams

Returns a new instance of CodeActionParams.



8
9
10
11
12
13
14
15
16
17
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 8

def initialize(partial_result_token: nil, text_document:, range:, context:)
  @attributes = {}

  @attributes[:partialResultToken] = partial_result_token if partial_result_token
  @attributes[:textDocument] = text_document
  @attributes[:range] = range
  @attributes[:context] = context

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



43
44
45
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 43

def attributes
  @attributes
end

Instance Method Details

#contextCodeActionContext

Context carrying additional information.

Returns:



39
40
41
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 39

def context
  attributes.fetch(:context)
end

#rangeRange

The range for which the command was invoked.

Returns:



31
32
33
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 31

def range
  attributes.fetch(:range)
end

#text_documentTextDocumentIdentifier

The document in which the command was invoked.



23
24
25
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 23

def text_document
  attributes.fetch(:textDocument)
end

#to_hashObject



45
46
47
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 45

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



49
50
51
# File 'lib/language_server/protocol/interface/code_action_params.rb', line 49

def to_json(*args)
  to_hash.to_json(*args)
end