Class: LanguageServer::Protocol::Interface::CompletionContext
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::CompletionContext
- Defined in:
- lib/language_server/protocol/interface/completion_context.rb
Overview
Contains additional information about the context in which a completion request is triggered.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(trigger_kind:, trigger_character: nil) ⇒ CompletionContext
constructor
A new instance of CompletionContext.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
-
#trigger_character ⇒ string
The trigger character (a single character) that has trigger code complete.
-
#trigger_kind ⇒ CompletionTriggerKind
How the completion was triggered.
Constructor Details
#initialize(trigger_kind:, trigger_character: nil) ⇒ CompletionContext
Returns a new instance of CompletionContext.
9 10 11 12 13 14 15 16 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 9 def initialize(trigger_kind:, trigger_character: nil) @attributes = {} @attributes[:triggerKind] = trigger_kind @attributes[:triggerCharacter] = trigger_character if trigger_character @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
36 37 38 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 36 def attributes @attributes end |
Instance Method Details
#to_hash ⇒ Object
38 39 40 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 38 def to_hash attributes end |
#to_json(*args) ⇒ Object
42 43 44 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 42 def to_json(*args) to_hash.to_json(*args) end |
#trigger_character ⇒ string
The trigger character (a single character) that has trigger code complete. Is undefined if ‘triggerKind !== CompletionTriggerKind.TriggerCharacter`
32 33 34 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 32 def trigger_character attributes.fetch(:triggerCharacter) end |
#trigger_kind ⇒ CompletionTriggerKind
How the completion was triggered.
22 23 24 |
# File 'lib/language_server/protocol/interface/completion_context.rb', line 22 def trigger_kind attributes.fetch(:triggerKind) end |