Class: LanguageServer::Protocol::Interface::TextEdit

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range:, new_text:) ⇒ TextEdit

Returns a new instance of TextEdit.



5
6
7
8
9
10
11
12
# File 'lib/language_server/protocol/interface/text_edit.rb', line 5

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

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

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#new_textstring

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

Returns:

  • (string)


28
29
30
# File 'lib/language_server/protocol/interface/text_edit.rb', line 28

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:



19
20
21
# File 'lib/language_server/protocol/interface/text_edit.rb', line 19

def range
  attributes.fetch(:range)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



38
39
40
# File 'lib/language_server/protocol/interface/text_edit.rb', line 38

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