Class: LanguageServer::Protocol::Interface::InlayHintLabelPart

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/inlay_hint_label_part.rb,
sig/language_server/protocol/interface/inlay_hint_label_part.rbs

Overview

An inlay hint label part allows for interactive and composite labels of inlay hints.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, tooltip: nil, location: nil, command: nil) ⇒ InlayHintLabelPart

Returns a new instance of InlayHintLabelPart.

Parameters:

  • value: (String)
  • tooltip: (Object) (defaults to: nil)
  • location: (Object) (defaults to: nil)
  • command: (Object) (defaults to: nil)

Since:

  • 3.17.0



11
12
13
14
15
16
17
18
19
20
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 11

def initialize(value:, tooltip: nil, location: nil, command: nil)
  @attributes = {}

  @attributes[:value] = value
  @attributes[:tooltip] = tooltip if tooltip
  @attributes[:location] = location if location
  @attributes[:command] = command if command

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



69
70
71
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 69

def attributes
  @attributes
end

Instance Method Details

#commandCommand

An optional command for this label part.

Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

Returns:

Since:

  • 3.17.0



65
66
67
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 65

def command
  attributes.fetch(:command)
end

#locationLocation

An optional source code location that represents this label part.

The editor will use this location for the hover and for code navigation features: This part will become a clickable link that resolves to the definition of the symbol at the given location (not necessarily the location itself), it shows the hover that shows at the given location, and it shows a context menu with further code navigation commands.

Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

Returns:

Since:

  • 3.17.0



54
55
56
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 54

def location
  attributes.fetch(:location)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



71
72
73
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 71

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

Since:

  • 3.17.0



75
76
77
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 75

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

#tooltipstring | MarkupContent

The tooltip text when you hover over this label part. Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

Returns:

Since:

  • 3.17.0



36
37
38
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 36

def tooltip
  attributes.fetch(:tooltip)
end

#valuestring

The value of this label part.

Returns:

  • (string)

Since:

  • 3.17.0



26
27
28
# File 'lib/language_server/protocol/interface/inlay_hint_label_part.rb', line 26

def value
  attributes.fetch(:value)
end