Sha256: fb39f9a417ede7ab960e996ca1a175063eace89707a0465518250a189bc2baa9

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class TextDocumentSyncOptions
        def initialize(open_close: nil, change: nil, will_save: nil, will_save_wait_until: nil, save: nil)
          @attributes = {}

          @attributes[:openClose] = open_close if open_close
          @attributes[:change] = change if change
          @attributes[:willSave] = will_save if will_save
          @attributes[:willSaveWaitUntil] = will_save_wait_until if will_save_wait_until
          @attributes[:save] = save if save

          @attributes.freeze
        end

        #
        # Open and close notifications are sent to the server.
        #
        # @return [boolean]
        def open_close
          attributes.fetch(:openClose)
        end

        #
        # Change notificatins are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
        # and TextDocumentSyncKindIncremental.
        #
        # @return [number]
        def change
          attributes.fetch(:change)
        end

        #
        # Will save notifications are sent to the server.
        #
        # @return [boolean]
        def will_save
          attributes.fetch(:willSave)
        end

        #
        # Will save wait until requests are sent to the server.
        #
        # @return [boolean]
        def will_save_wait_until
          attributes.fetch(:willSaveWaitUntil)
        end

        #
        # Save notifications are sent to the server.
        #
        # @return [SaveOptions]
        def save
          attributes.fetch(:save)
        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_sync_options.rb