Class: LanguageServer::Protocol::Interface::InlayHint
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::InlayHint
- Defined in:
- lib/language_server/protocol/interface/inlay_hint.rb
Overview
Inlay hint information.
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#data ⇒ LSPAny | nil
A data entry field that is preserved on an inlay hint between a
textDocument/inlayHintand ainlayHint/resolverequest. -
#initialize(position:, label:, kind: nil, text_edits: nil, tooltip: nil, padding_left: nil, padding_right: nil, data: nil) ⇒ InlayHint
constructor
A new instance of InlayHint.
-
#kind ⇒ InlayHintKind | nil
The kind of this hint.
-
#label ⇒ string | InlayHintLabelPart[]
The label of this hint.
-
#padding_left ⇒ boolean | nil
Render padding before the hint.
-
#padding_right ⇒ boolean | nil
Render padding after the hint.
-
#position ⇒ Position
The position of this hint.
-
#text_edits ⇒ TextEdit[] | nil
Optional text edits that are performed when accepting this inlay hint.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
-
#tooltip ⇒ string | MarkupContent | nil
The tooltip text when you hover over this item.
Constructor Details
#initialize(position:, label:, kind: nil, text_edits: nil, tooltip: nil, padding_left: nil, padding_right: nil, data: nil) ⇒ InlayHint
Returns a new instance of InlayHint.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 10 def initialize(position:, label:, kind: nil, text_edits: nil, tooltip: nil, padding_left: nil, padding_right: nil, data: nil) @attributes = {} @attributes[:position] = position @attributes[:label] = label @attributes[:kind] = kind if kind @attributes[:textEdits] = text_edits if text_edits @attributes[:tooltip] = tooltip if tooltip @attributes[:paddingLeft] = padding_left if padding_left @attributes[:paddingRight] = padding_right if padding_right @attributes[:data] = data if data @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
106 107 108 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 106 def attributes @attributes end |
Instance Method Details
#data ⇒ LSPAny | nil
A data entry field that is preserved on an inlay hint between a textDocument/inlayHint and a inlayHint/resolve request.
102 103 104 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 102 def data attributes.fetch(:data) end |
#kind ⇒ InlayHintKind | nil
The kind of this hint. Can be omitted in which case the client should fall back to a reasonable default.
49 50 51 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 49 def kind attributes.fetch(:kind) end |
#label ⇒ string | InlayHintLabelPart[]
The label of this hint. A human readable string or an array of InlayHintLabelPart label parts.
Note that neither the string nor the label part can be empty.
40 41 42 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 40 def label attributes.fetch(:label) end |
#padding_left ⇒ boolean | nil
Render padding before the hint.
Note: Padding should use the editor’s background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.
81 82 83 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 81 def padding_left attributes.fetch(:paddingLeft) end |
#padding_right ⇒ boolean | nil
Render padding after the hint.
Note: Padding should use the editor’s background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.
93 94 95 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 93 def padding_right attributes.fetch(:paddingRight) end |
#position ⇒ Position
The position of this hint.
29 30 31 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 29 def position attributes.fetch(:position) end |
#text_edits ⇒ TextEdit[] | nil
Optional text edits that are performed when accepting this inlay hint.
Note that edits are expected to change the document so that the inlay hint (or its nearest variant) is now part of the document and the inlay hint itself is now obsolete.
61 62 63 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 61 def text_edits attributes.fetch(:textEdits) end |
#to_hash ⇒ Object
108 109 110 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 108 def to_hash attributes end |
#to_json(*args) ⇒ Object
112 113 114 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 112 def to_json(*args) to_hash.to_json(*args) end |
#tooltip ⇒ string | MarkupContent | nil
The tooltip text when you hover over this item.
69 70 71 |
# File 'lib/language_server/protocol/interface/inlay_hint.rb', line 69 def tooltip attributes.fetch(:tooltip) end |