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.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CompletionItemLabelDetails.

Since:

  • 3.17.0



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

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)

Since:

  • 3.17.0



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

def attributes
  @attributes
end

Instance Method Details

#descriptionstring | nil

An optional string which is rendered less prominently after CompletionItem.detail. Should be used for fully qualified names and file paths.

Returns:

  • (string | nil)

Since:

  • 3.17.0



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

def description
  attributes.fetch(:description)
end

#detailstring | nil

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

Returns:

  • (string | nil)

Since:

  • 3.17.0



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

def detail
  attributes.fetch(:detail)
end

#to_hashObject

Since:

  • 3.17.0



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

Since:

  • 3.17.0



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