Class: LanguageServer::Protocol::Interface::CompletionContext

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#attributesObject (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_hashObject



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_characterstring

The trigger character (a single character) that has trigger code complete. Is undefined if ‘triggerKind !== CompletionTriggerKind.TriggerCharacter`

Returns:

  • (string)


32
33
34
# File 'lib/language_server/protocol/interface/completion_context.rb', line 32

def trigger_character
  attributes.fetch(:triggerCharacter)
end

#trigger_kindCompletionTriggerKind

How the completion was triggered.

Returns:

  • (CompletionTriggerKind)


22
23
24
# File 'lib/language_server/protocol/interface/completion_context.rb', line 22

def trigger_kind
  attributes.fetch(:triggerKind)
end