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
Returns the value of attribute attributes.
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.
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
#attributes ⇒ Object (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
#insert ⇒ Range
The range if the insert is requested
30 31 32 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 30 def insert attributes.fetch(:insert) end |
#new_text ⇒ string
The string to be inserted.
22 23 24 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 22 def new_text attributes.fetch(:newText) end |
#replace ⇒ Range
The range if the replace is requested.
38 39 40 |
# File 'lib/language_server/protocol/interface/insert_replace_edit.rb', line 38 def replace attributes.fetch(:replace) end |
#to_hash ⇒ Object
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 |