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

Inherits:
Object
  • Object
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

Constructor Details

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

Returns a new instance of CodeActionParams.



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

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

  @attributes[:textDocument] = text_document
  @attributes[:range] = range
  @attributes[:context] = context

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#contextCodeActionContext

Context carrying additional information.

Returns:



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

def context
  attributes.fetch(:context)
end

#rangeRange

The range for which the command was invoked.

Returns:



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

def range
  attributes.fetch(:range)
end

#text_documentTextDocumentIdentifier

The document in which the command was invoked.



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

def text_document
  attributes.fetch(:textDocument)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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