Class: LanguageServer::Protocol::Interface::SignatureHelp
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::SignatureHelp
- Defined in:
- lib/language_server/protocol/interface/signature_help.rb,
sig/language_server/protocol/interface/signature_help.rbs
Overview
Signature help represents the signature of something callable. There can be multiple signature but only one active and only one active parameter.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash[Symbol, untyped]
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#active_parameter ⇒ uinteger
The active parameter of the active signature.
-
#active_signature ⇒ uinteger
The active signature.
-
#initialize(signatures:, active_signature: nil, active_parameter: nil) ⇒ SignatureHelp
constructor
A new instance of SignatureHelp.
-
#signatures ⇒ SignatureInformation[]
One or more signatures.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(signatures:, active_signature: nil, active_parameter: nil) ⇒ SignatureHelp
Returns a new instance of SignatureHelp.
10 11 12 13 14 15 16 17 18 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 10 def initialize(signatures:, active_signature: nil, active_parameter: nil) @attributes = {} @attributes[:signatures] = signatures @attributes[:activeSignature] = active_signature if active_signature @attributes[:activeParameter] = active_parameter if active_parameter @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
Returns the value of attribute attributes.
58 59 60 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 58 def attributes @attributes end |
Instance Method Details
#active_parameter ⇒ uinteger
The active parameter of the active signature. If omitted or the value
lies outside the range of signatures[activeSignature].parameters
defaults to 0 if the active signature has parameters. If
the active signature has no parameters it is ignored.
In future version of the protocol this property might become
mandatory to better express the active parameter if the
active signature does have any.
54 55 56 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 54 def active_parameter attributes.fetch(:activeParameter) end |
#active_signature ⇒ uinteger
The active signature. If omitted or the value lies outside the
range of signatures the value defaults to zero or is ignored if
the SignatureHelp has no signatures.
Whenever possible implementors should make an active decision about the active signature and shouldn't rely on a default value.
In future version of the protocol this property might become mandatory to better express this.
40 41 42 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 40 def active_signature attributes.fetch(:activeSignature) end |
#signatures ⇒ SignatureInformation[]
One or more signatures.
24 25 26 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 24 def signatures attributes.fetch(:signatures) end |
#to_hash ⇒ Hash[Symbol, untyped]
60 61 62 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 60 def to_hash attributes end |
#to_json(*args) ⇒ String
64 65 66 |
# File 'lib/language_server/protocol/interface/signature_help.rb', line 64 def to_json(*args) to_hash.to_json(*args) end |