Sha256: 9c2bbea1c47d788dc18440836b39a4ea3e2a6003203c2984877eaa3792d6695a

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      class DidSaveTextDocumentParams
        def initialize(text_document:, text: nil)
          @attributes = {}

          @attributes[:textDocument] = text_document
          @attributes[:text] = text if text

          @attributes.freeze
        end

        #
        # The document that was saved.
        #
        # @return [TextDocumentIdentifier]
        def text_document
          attributes.fetch(:textDocument)
        end

        #
        # Optional the content when saved. Depends on the includeText value
        # when the save notifcation was requested.
        #
        # @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/did_save_text_document_params.rb