Class: LanguageServer::Protocol::Interface::ParameterInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/parameter_information.rb

Overview

Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, documentation: nil) ⇒ ParameterInformation

Returns a new instance of ParameterInformation.



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

def initialize(label:, documentation: nil)
  @attributes = {}

  @attributes[:label] = label
  @attributes[:documentation] = documentation if documentation

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



36
37
38
# File 'lib/language_server/protocol/interface/parameter_information.rb', line 36

def attributes
  @attributes
end

Instance Method Details

#documentationstring | MarkupContent

The human-readable doc-comment of this parameter. Will be shown in the UI but can be omitted.

Returns:



32
33
34
# File 'lib/language_server/protocol/interface/parameter_information.rb', line 32

def documentation
  attributes.fetch(:documentation)
end

#labelstring

The label of this parameter. Will be shown in the UI.

Returns:

  • (string)


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

def label
  attributes.fetch(:label)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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