Sha256: 092aa0d5d8204c29ad9df717ed13e9fc979d141b7e8736444f4bf346bbfb42b1

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class TextDocumentItem
        def initialize(uri:, language_id:, version:, text:)
          @attributes = {}

          @attributes[:uri] = uri
          @attributes[:languageId] = language_id
          @attributes[:version] = version
          @attributes[:text] = text

          @attributes.freeze
        end

        #
        # The text document's URI.
        #
        # @return [string]
        def uri
          attributes.fetch(:uri)
        end

        #
        # The text document's language identifier.
        #
        # @return [string]
        def language_id
          attributes.fetch(:languageId)
        end

        #
        # The version number of this document (it will strictly increase after each
        # change, including undo/redo).
        #
        # @return [number]
        def version
          attributes.fetch(:version)
        end

        #
        # The content of the opened text document.
        #
        # @return [string]
        def text
          attributes.fetch(:text)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
language_server-protocol-0.5.0 lib/language_server/protocol/interface/text_document_item.rb