Class: LanguageServer::Protocol::Interface::InsertReplaceEdit

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

Overview

A special text edit to provide an insert and a replace operation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_text:, insert:, replace:) ⇒ InsertReplaceEdit

Returns a new instance of InsertReplaceEdit.



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

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

  @attributes[:newText] = new_text
  @attributes[:insert] = insert
  @attributes[:replace] = replace

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#insertRange

The range if the insert is requested

Returns:



30
31
32
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 30

def insert
  attributes.fetch(:insert)
end

#new_textstring

The string to be inserted.

Returns:

  • (string)


22
23
24
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 22

def new_text
  attributes.fetch(:newText)
end

#replaceRange

The range if the replace is requested.

Returns:



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

def replace
  attributes.fetch(:replace)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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