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.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ChangeAnnotation.

Since:

  • 3.16.0



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

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)

Since:

  • 3.16.0



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

def attributes
  @attributes
end

Instance Method Details

#descriptionstring | nil

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

Returns:

  • (string | nil)

Since:

  • 3.16.0



43
44
45
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 43

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)

Since:

  • 3.16.0



25
26
27
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 25

def label
  attributes.fetch(:label)
end

#needs_confirmationboolean | nil

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

Returns:

  • (boolean | nil)

Since:

  • 3.16.0



34
35
36
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 34

def needs_confirmation
  attributes.fetch(:needsConfirmation)
end

#to_hashObject

Since:

  • 3.16.0



49
50
51
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 49

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



53
54
55
# File 'lib/language_server/protocol/interface/change_annotation.rb', line 53

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