Class: LSP::ColorPresentation

Inherits:
LSPBase
  • Object
show all
Defined in:
lib/lsp/lsp_types.rb

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 which is applied to a document when selecting * this presentation for the color. When falsy the label * is used. / textEdit?: TextEdit; /* * An optional array of additional text edits that are applied when * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. */ additionalTextEdits?: TextEdit; }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

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

#additionalTextEditsObject

type: string # type: TextEdit # type: TextEdit



190
191
192
# File 'lib/lsp/lsp_types.rb', line 190

def additionalTextEdits
  @additionalTextEdits
end

#labelObject

type: string # type: TextEdit # type: TextEdit



190
191
192
# File 'lib/lsp/lsp_types.rb', line 190

def label
  @label
end

#textEditObject

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