Sha256: b9a6f8031231fe7c80002ee2e5c7da85ccfdd3a36c7eb290ec546f5f5d95ad4f

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      class TextEdit
        def initialize(range:, new_text:)
          @attributes = {}

          @attributes[:range] = range
          @attributes[:newText] = new_text

          @attributes.freeze
        end

        #
        # The range of the text document to be manipulated. To insert
        # text into a document create a range where start === end.
        #
        # @return [Range]
        def range
          attributes.fetch(:range)
        end

        #
        # The string to be inserted. For delete operations use an
        # empty string.
        #
        # @return [string]
        def new_text
          attributes.fetch(:newText)
        end

        attr_reader :attributes

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/text_edit.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/text_edit.rb