class LanguageServer::Protocol::Interface::TextDocumentContentChangeEvent

An event describing a change to a text document. If range and rangeLength are omitted the new text is considered to be the full content of the document.

Attributes

attributes[R]

Public Class Methods

new(range: nil, range_length: nil, text:) click to toggle source
# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 9
def initialize(range: nil, range_length: nil, text:)
  @attributes = {}

  @attributes[:range] = range if range
  @attributes[:rangeLength] = range_length if range_length
  @attributes[:text] = text

  @attributes.freeze
end

Public Instance Methods

range() click to toggle source

The range of the document that changed.

@return [Range, nil]

# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 23
def range
  attributes.fetch(:range)
end
range_length() click to toggle source

The optional length of the range that got replaced.

@return [number, nil]

# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 31
def range_length
  attributes.fetch(:rangeLength)
end
text() click to toggle source

The new text for the provided range.

— OR —

The new text of the whole document.

@return [string]

# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 43
def text
  attributes.fetch(:text)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 49
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/text_document_content_change_event.rb, line 53
def to_json(*args)
  to_hash.to_json(*args)
end