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.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InsertReplaceEdit.

Since:

  • 3.16.0



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

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)

Since:

  • 3.16.0



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

def attributes
  @attributes
end

Instance Method Details

#insertRange

The range if the insert is requested

Returns:

Since:

  • 3.16.0



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

def insert
  attributes.fetch(:insert)
end

#new_textstring

The string to be inserted.

Returns:

  • (string)

Since:

  • 3.16.0



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

def new_text
  attributes.fetch(:newText)
end

#replaceRange

The range if the replace is requested.

Returns:

Since:

  • 3.16.0



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

def replace
  attributes.fetch(:replace)
end

#to_hashObject

Since:

  • 3.16.0



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



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

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