Class: LanguageServer::Protocol::Interface::TextDocumentEdit

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

Overview

Describes textual changes on a text document. A TextDocumentEdit describes all changes on a document version Si and after they are applied move the document to version Si+1. So the creator of a TextDocumentEdit doesn’t need to sort the array of edits or do any kind of ordering. However the edits must be non overlapping.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text_document:, edits:) ⇒ TextDocumentEdit

Returns a new instance of TextDocumentEdit.



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

def initialize(text_document:, edits:)
  @attributes = {}

  @attributes[:textDocument] = text_document
  @attributes[:edits] = edits

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



39
40
41
# File 'lib/language_server/protocol/interface/text_document_edit.rb', line 39

def attributes
  @attributes
end

Instance Method Details

#editsTextEdit | AnnotatedTextEdit[]

The edits to be applied.

client capability.

Returns:

Since:

  • 3.16.0 - support for AnnotatedTextEdit. This is guarded using a



35
36
37
# File 'lib/language_server/protocol/interface/text_document_edit.rb', line 35

def edits
  attributes.fetch(:edits)
end

#text_documentOptionalVersionedTextDocumentIdentifier

The text document to change.



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

def text_document
  attributes.fetch(:textDocument)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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