Class: LanguageServer::Protocol::Interface::TextEdit
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::TextEdit
- Defined in:
- lib/language_server/protocol/interface/text_edit.rb
Overview
A text edit applicable to a text document.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(range:, new_text:) ⇒ TextEdit
constructor
A new instance of TextEdit.
-
#new_text ⇒ string
The string to be inserted.
-
#range ⇒ Range
The range of the text document to be manipulated.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(range:, new_text:) ⇒ TextEdit
Returns a new instance of TextEdit.
8 9 10 11 12 13 14 15 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 8 def initialize(range:, new_text:) @attributes = {} @attributes[:range] = range @attributes[:newText] = new_text @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
35 36 37 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 35 def attributes @attributes end |
Instance Method Details
#new_text ⇒ string
The string to be inserted. For delete operations use an empty string.
31 32 33 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 31 def new_text attributes.fetch(:newText) end |
#range ⇒ Range
The range of the text document to be manipulated. To insert text into a document create a range where start === end.
22 23 24 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 22 def range attributes.fetch(:range) end |
#to_hash ⇒ Object
37 38 39 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 37 def to_hash attributes end |
#to_json(*args) ⇒ Object
41 42 43 |
# File 'lib/language_server/protocol/interface/text_edit.rb', line 41 def to_json(*args) to_hash.to_json(*args) end |