Sha256: f2eb35e40943a3fde0bfa307d5ee4e5e57db1d38d3b210e7209480cec3fe3fd6

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class DocumentOnTypeFormattingRegistrationOptions
        def initialize(document_selector:, first_trigger_character:, more_trigger_character: nil)
          @attributes = {}

          @attributes[:documentSelector] = document_selector
          @attributes[:firstTriggerCharacter] = first_trigger_character
          @attributes[:moreTriggerCharacter] = more_trigger_character if more_trigger_character

          @attributes.freeze
        end

        #
        # A document selector to identify the scope of the registration. If set to
        # null the document selector provided on the client side will be used.
        #
        # @return [DocumentSelector]
        def document_selector
          attributes.fetch(:documentSelector)
        end

        #
        # A character on which formatting should be triggered, like `}`.
        #
        # @return [string]
        def first_trigger_character
          attributes.fetch(:firstTriggerCharacter)
        end

        #
        # More trigger characters.
        #
        # @return [string[]]
        def more_trigger_character
          attributes.fetch(:moreTriggerCharacter)
        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

3 entries across 3 versions & 1 rubygems

Version Path
language_server-protocol-3.16.0.3 lib/language_server/protocol/interface/document_on_type_formatting_registration_options.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/document_on_type_formatting_registration_options.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/document_on_type_formatting_registration_options.rb