Class: LanguageServer::Protocol::Interface::SignatureInformation

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

Overview

Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, documentation: nil, parameters: nil) ⇒ SignatureInformation

Returns a new instance of SignatureInformation.



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

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

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

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#documentationstring | MarkupContent

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

Returns:



34
35
36
# File 'lib/language_server/protocol/interface/signature_information.rb', line 34

def documentation
  attributes.fetch(:documentation)
end

#labelstring

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

Returns:

  • (string)


25
26
27
# File 'lib/language_server/protocol/interface/signature_information.rb', line 25

def label
  attributes.fetch(:label)
end

#parametersParameterInformation[]

The parameters of this signature.

Returns:



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

def parameters
  attributes.fetch(:parameters)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



52
53
54
# File 'lib/language_server/protocol/interface/signature_information.rb', line 52

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