class LanguageServer::Protocol::Interface::SignatureInformation

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

Attributes

attributes[R]

Public Class Methods

new(label:, documentation: nil, parameters: nil, active_parameter: nil) click to toggle source
# File lib/language_server/protocol/interface/signature_information.rb, line 10
def initialize(label:, documentation: nil, parameters: nil, active_parameter: nil)
  @attributes = {}

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

  @attributes.freeze
end

Public Instance Methods

active_parameter() click to toggle source

The index of the active parameter.

If provided, this is used in place of `SignatureHelp.activeParameter`.

@return [number]

# File lib/language_server/protocol/interface/signature_information.rb, line 53
def active_parameter
  attributes.fetch(:activeParameter)
end
documentation() click to toggle source

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

@return [string | MarkupContent]

# File lib/language_server/protocol/interface/signature_information.rb, line 35
def documentation
  attributes.fetch(:documentation)
end
label() click to toggle source

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

@return [string]

# File lib/language_server/protocol/interface/signature_information.rb, line 26
def label
  attributes.fetch(:label)
end
parameters() click to toggle source

The parameters of this signature.

@return [ParameterInformation

# File lib/language_server/protocol/interface/signature_information.rb, line 43
def parameters
  attributes.fetch(:parameters)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/signature_information.rb, line 59
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/signature_information.rb, line 63
def to_json(*args)
  to_hash.to_json(*args)
end