Class: LanguageServer::Protocol::Interface::CompletionItemLabelDetails

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

Overview

Additional details for a completion item label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(detail: nil, description: nil) ⇒ CompletionItemLabelDetails

Returns a new instance of CompletionItemLabelDetails.



8
9
10
11
12
13
14
15
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 8

def initialize(detail: nil, description: nil)
  @attributes = {}

  @attributes[:detail] = detail if detail
  @attributes[:description] = description if description

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



37
38
39
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 37

def attributes
  @attributes
end

Instance Method Details

#descriptionstring

An optional string which is rendered less prominently after CompletionItemLabelDetails.detail. Should be used for fully qualified names or file path.

Returns:

  • (string)


33
34
35
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 33

def description
  attributes.fetch(:description)
end

#detailstring

An optional string which is rendered less prominently directly after CompletionItem.label label, without any spacing. Should be used for function signatures or type annotations.

Returns:

  • (string)


23
24
25
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 23

def detail
  attributes.fetch(:detail)
end

#to_hashObject



39
40
41
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 39

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



43
44
45
# File 'lib/language_server/protocol/interface/completion_item_label_details.rb', line 43

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