Class: LSP::ColorPresentation
Overview
export interface ColorPresentation
/**
* 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.
*/
label: string;
/**
* An [edit](#TextEdit) which is applied to a document when selecting
* this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
* is used.
*/
textEdit?: TextEdit;
/**
* An optional array of additional [text edits](#TextEdit) that are applied when
* selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
*/
additionalTextEdits?: TextEdit[];
Instance Attribute Summary collapse
-
#additionalTextEdits ⇒ Object
type: string # type: TextEdit # type: TextEdit[].
-
#label ⇒ Object
type: string # type: TextEdit # type: TextEdit[].
-
#textEdit ⇒ Object
type: string # type: TextEdit # type: TextEdit[].
Instance Method Summary collapse
- #from_h!(value) ⇒ Object
-
#initialize(initial_hash = nil) ⇒ ColorPresentation
constructor
A new instance of ColorPresentation.
Methods inherited from LSPBase
Constructor Details
#initialize(initial_hash = nil) ⇒ ColorPresentation
Returns a new instance of ColorPresentation.
192 193 194 195 |
# File 'lib/lsp/lsp_types.rb', line 192 def initialize(initial_hash = nil) super @optional_method_names = %i[textEdit additionalTextEdits] end |
Instance Attribute Details
#additionalTextEdits ⇒ Object
type: string # type: TextEdit # type: TextEdit[]
190 191 192 |
# File 'lib/lsp/lsp_types.rb', line 190 def additionalTextEdits @additionalTextEdits end |
#label ⇒ Object
type: string # type: TextEdit # type: TextEdit[]
190 191 192 |
# File 'lib/lsp/lsp_types.rb', line 190 def label @label end |
#textEdit ⇒ Object
type: string # type: TextEdit # type: TextEdit[]
190 191 192 |
# File 'lib/lsp/lsp_types.rb', line 190 def textEdit @textEdit end |
Instance Method Details
#from_h!(value) ⇒ Object
197 198 199 200 201 202 203 |
# File 'lib/lsp/lsp_types.rb', line 197 def from_h!(value) value = {} if value.nil? self.label = value['label'] self.textEdit = TextEdit.new(value['textEdit']) unless value['textEdit'].nil? self.additionalTextEdits = to_typed_aray(value['additionalTextEdits'], TextEdit) self end |