Sha256: 3b170dd15694be18796a0c4eeea527b55b08cb24a38b3b4d81d654463bcfe0ce

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Format document on type options.
      #
      class DocumentOnTypeFormattingOptions
        def initialize(first_trigger_character:, more_trigger_character: nil)
          @attributes = {}

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

          @attributes.freeze
        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

4 entries across 4 versions & 1 rubygems

Version Path
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/document_on_type_formatting_options.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/document_on_type_formatting_options.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/document_on_type_formatting_options.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/document_on_type_formatting_options.rb