Class: LanguageServer::Protocol::Interface::SignatureInformation
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::SignatureInformation
- 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
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#active_parameter ⇒ number
The index of the active parameter.
-
#documentation ⇒ string | MarkupContent
The human-readable doc-comment of this signature.
-
#initialize(label:, documentation: nil, parameters: nil, active_parameter: nil) ⇒ SignatureInformation
constructor
A new instance of SignatureInformation.
-
#label ⇒ string
The label of this signature.
-
#parameters ⇒ ParameterInformation[]
The parameters of this signature.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(label:, documentation: nil, parameters: nil, active_parameter: nil) ⇒ SignatureInformation
Returns a new instance of SignatureInformation.
10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
57 58 59 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 57 def attributes @attributes end |
Instance Method Details
#active_parameter ⇒ number
The index of the active parameter.
If provided, this is used in place of ‘SignatureHelp.activeParameter`.
53 54 55 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 53 def active_parameter attributes.fetch(:activeParameter) end |
#documentation ⇒ string | MarkupContent
The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted.
35 36 37 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 35 def documentation attributes.fetch(:documentation) end |
#label ⇒ string
The label of this signature. Will be shown in the UI.
26 27 28 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 26 def label attributes.fetch(:label) end |
#parameters ⇒ ParameterInformation[]
The parameters of this signature.
43 44 45 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 43 def parameters attributes.fetch(:parameters) end |
#to_hash ⇒ Object
59 60 61 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 59 def to_hash attributes end |
#to_json(*args) ⇒ Object
63 64 65 |
# File 'lib/language_server/protocol/interface/signature_information.rb', line 63 def to_json(*args) to_hash.to_json(*args) end |