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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of AnnotatedTextEdit.



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

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

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

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



44
45
46
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 44

def attributes
  @attributes
end

Instance Method Details

#annotation_idstring

The actual annotation identifier.

Returns:

  • (string)


40
41
42
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 40

def annotation_id
  attributes.fetch(:annotationId)
end

#new_textstring

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

Returns:

  • (string)


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

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:



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

def range
  attributes.fetch(:range)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



50
51
52
# File 'lib/language_server/protocol/interface/annotated_text_edit.rb', line 50

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