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.



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

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:



40
41
42
# File 'lib/language_server/protocol/interface/parameter_information.rb', line 40

def documentation
  attributes.fetch(:documentation)
end

#labelstring | [number, number]

The label of this parameter information.

Either a string or an inclusive start and exclusive end offsets within its containing signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 string representation as ‘Position` and `Range` does.

Note: a label of type string should be a substring of its containing signature label. Its intended use case is to highlight the parameter label part in the ‘SignatureInformation.label`.

Returns:

  • (string | [number, number])


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

def label
  attributes.fetch(:label)
end

#to_hashObject



46
47
48
# File 'lib/language_server/protocol/interface/parameter_information.rb', line 46

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



50
51
52
# File 'lib/language_server/protocol/interface/parameter_information.rb', line 50

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