Class: LanguageServer::Protocol::Interface::ColorPresentation
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::ColorPresentation
- Defined in:
- lib/language_server/protocol/interface/color_presentation.rb,
sig/language_server/protocol/interface/color_presentation.rbs
Instance Attribute Summary collapse
-
#attributes ⇒ Hash[Symbol, untyped]
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#additional_text_edits ⇒ TextEdit[]
An optional array of additional TextEdit text edits that are applied when selecting this color presentation.
-
#initialize(label:, text_edit: nil, additional_text_edits: nil) ⇒ ColorPresentation
constructor
A new instance of ColorPresentation.
-
#label ⇒ string
The label of this color presentation.
-
#text_edit ⇒ TextEdit
An TextEdit edit which is applied to a document when selecting this presentation for the color.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(label:, text_edit: nil, additional_text_edits: nil) ⇒ ColorPresentation
Returns a new instance of ColorPresentation.
5 6 7 8 9 10 11 12 13 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 5 def initialize(label:, text_edit: nil, additional_text_edits: nil) @attributes = {} @attributes[:label] = label @attributes[:textEdit] = text_edit if text_edit @attributes[:additionalTextEdits] = additional_text_edits if additional_text_edits @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
Returns the value of attribute attributes.
44 45 46 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 44 def attributes @attributes end |
Instance Method Details
#additional_text_edits ⇒ TextEdit[]
An optional array of additional TextEdit text edits that are applied when selecting this color presentation. Edits must not overlap with the main ColorPresentation.textEdit edit nor with themselves.
40 41 42 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 40 def additional_text_edits attributes.fetch(:additionalTextEdits) end |
#label ⇒ string
The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation.
21 22 23 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 21 def label attributes.fetch(:label) end |
#text_edit ⇒ TextEdit
An TextEdit edit which is applied to a document when selecting
this presentation for the color. When falsy the ColorPresentation.label label
is used.
31 32 33 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 31 def text_edit attributes.fetch(:textEdit) end |
#to_hash ⇒ Hash[Symbol, untyped]
46 47 48 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 46 def to_hash attributes end |
#to_json(*args) ⇒ String
50 51 52 |
# File 'lib/language_server/protocol/interface/color_presentation.rb', line 50 def to_json(*args) to_hash.to_json(*args) end |