Class: LanguageServer::Protocol::Interface::ChangeAnnotation

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/change_annotation.rb

Overview

Additional information that describes document changes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, needs_confirmation: nil, description: nil) ⇒ ChangeAnnotation

Returns a new instance of ChangeAnnotation.



8
9
10
11
12
13
14
15
16
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 8

def initialize(label:, needs_confirmation: nil, description: nil)
  @attributes = {}

  @attributes[:label] = label
  @attributes[:needsConfirmation] = needs_confirmation if needs_confirmation
  @attributes[:description] = description if description

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



45
46
47
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 45

def attributes
  @attributes
end

Instance Method Details

#descriptionstring

A human-readable string which is rendered less prominent in the user interface.

Returns:

  • (string)


41
42
43
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 41

def description
  attributes.fetch(:description)
end

#labelstring

A human-readable string describing the actual change. The string is rendered prominent in the user interface.

Returns:

  • (string)


23
24
25
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 23

def label
  attributes.fetch(:label)
end

#needs_confirmationboolean

A flag which indicates that user confirmation is needed before applying the change.

Returns:

  • (boolean)


32
33
34
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 32

def needs_confirmation
  attributes.fetch(:needsConfirmation)
end

#to_hashObject



47
48
49
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 47

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



51
52
53
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 51

def to_json(*args)
  to_hash.to_json(*args)
end