class LanguageServer::Protocol::Interface::ColorPresentation

Attributes

attributes[R]

Public Class Methods

new(label:, text_edit: nil, additional_text_edits: nil) click to toggle source
# 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

Public Instance Methods

additional_text_edits() click to toggle source

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.

@return [TextEdit

# File lib/language_server/protocol/interface/color_presentation.rb, line 41
def additional_text_edits
  attributes.fetch(:additionalTextEdits)
end
label() click to toggle source

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.

@return [string]

# File lib/language_server/protocol/interface/color_presentation.rb, line 21
def label
  attributes.fetch(:label)
end
text_edit() click to toggle source

An [edit](#TextEdit) which is applied to a document when selecting this presentation for the color. When `falsy` the [label](#ColorPresentation.label) is used.

@return [TextEdit]

# File lib/language_server/protocol/interface/color_presentation.rb, line 31
def text_edit
  attributes.fetch(:textEdit)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/color_presentation.rb, line 47
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/color_presentation.rb, line 51
def to_json(*args)
  to_hash.to_json(*args)
end