Class: LanguageServer::Protocol::Interface::AnnotatedTextEdit

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

Overview

A special text edit with an additional change annotation.

Since:

  • 3.16.0.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(annotation_id:, range:, new_text:) ⇒ AnnotatedTextEdit

Returns a new instance of AnnotatedTextEdit.

Since:

  • 3.16.0.



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

def initialize(annotation_id:, range:, new_text:)
  @attributes = {}

  @attributes[:annotationId] = annotation_id
  @attributes[:range] = range
  @attributes[:newText] = new_text

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.16.0.



46
47
48
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 46

def attributes
  @attributes
end

Instance Method Details

#annotation_idChangeAnnotationIdentifier

The actual identifier of the change annotation

Returns:

  • (ChangeAnnotationIdentifier)

Since:

  • 3.16.0.



24
25
26
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 24

def annotation_id
  attributes.fetch(:annotationId)
end

#new_textstring

The string to be inserted. For delete operations use an empty string.

Returns:

  • (string)

Since:

  • 3.16.0.



42
43
44
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 42

def new_text
  attributes.fetch(:newText)
end

#rangeRange

The range of the text document to be manipulated. To insert text into a document create a range where start === end.

Returns:

Since:

  • 3.16.0.



33
34
35
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 33

def range
  attributes.fetch(:range)
end

#to_hashObject

Since:

  • 3.16.0.



48
49
50
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 48

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0.



52
53
54
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 52

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