Class: LanguageServer::Protocol::Interface::SignatureHelpContext

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

Overview

Additional information about the context in which a signature help request was triggered.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trigger_kind:, trigger_character: nil, is_retrigger:, active_signature_help: nil) ⇒ SignatureHelpContext

Returns a new instance of SignatureHelpContext.



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

def initialize(trigger_kind:, trigger_character: nil, is_retrigger:, active_signature_help: nil)
  @attributes = {}

  @attributes[:triggerKind] = trigger_kind
  @attributes[:triggerCharacter] = trigger_character if trigger_character
  @attributes[:isRetrigger] = is_retrigger
  @attributes[:activeSignatureHelp] = active_signature_help if active_signature_help

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



62
63
64
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 62

def attributes
  @attributes
end

Instance Method Details

#active_signature_helpSignatureHelp

The currently active ‘SignatureHelp`.

The ‘activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on the user navigating through available signatures.

Returns:



58
59
60
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 58

def active_signature_help
  attributes.fetch(:activeSignatureHelp)
end

#is_retriggerboolean

‘true` if signature help was already showing when it was triggered.

Retriggers occur when the signature help is already active and can be caused by actions such as typing a trigger character, a cursor move, or document content changes.

Returns:

  • (boolean)


47
48
49
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 47

def is_retrigger
  attributes.fetch(:isRetrigger)
end

#to_hashObject



64
65
66
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 64

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



68
69
70
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 68

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

#trigger_characterstring

Character that caused signature help to be triggered.

This is undefined when triggerKind !== SignatureHelpTriggerKind.TriggerCharacter

Returns:

  • (string)


35
36
37
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 35

def trigger_character
  attributes.fetch(:triggerCharacter)
end

#trigger_kindSignatureHelpTriggerKind

Action that caused signature help to be triggered.

Returns:

  • (SignatureHelpTriggerKind)


24
25
26
# File 'lib/language_server/protocol/interface/signature_help_context.rb', line 24

def trigger_kind
  attributes.fetch(:triggerKind)
end