Class: LanguageServer::Protocol::Interface::InsertReplaceEdit
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::InsertReplaceEdit
- 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
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(new_text:, insert:, replace:) ⇒ InsertReplaceEdit
constructor
A new instance of InsertReplaceEdit.
-
#insert ⇒ Range
The range if the insert is requested.
-
#new_text ⇒ string
The string to be inserted.
-
#replace ⇒ Range
The range if the replace is requested.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(new_text:, insert:, replace:) ⇒ InsertReplaceEdit
Returns a new instance of InsertReplaceEdit.
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
#attributes ⇒ Object (readonly)
44 45 46 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 44 def attributes @attributes end |
Instance Method Details
#insert ⇒ Range
The range if the insert is requested
32 33 34 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 32 def insert attributes.fetch(:insert) end |
#new_text ⇒ string
The string to be inserted.
24 25 26 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 24 def new_text attributes.fetch(:newText) end |
#replace ⇒ Range
The range if the replace is requested.
40 41 42 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 40 def replace attributes.fetch(:replace) end |
#to_hash ⇒ Object
46 47 48 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 46 def to_hash attributes end |
#to_json(*args) ⇒ Object
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 |