Sha256: 8007caa324bc1e69ef0d779e184f571a935a59bdb5ce138c483594a99c10af5d

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class DocumentOnTypeFormattingParams
        def initialize(text_document:, position:, ch:, options:)
          @attributes = {}

          @attributes[:textDocument] = text_document
          @attributes[:position] = position
          @attributes[:ch] = ch
          @attributes[:options] = options

          @attributes.freeze
        end

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

        #
        # The position inside the text document.
        #
        # @return [Position]
        def position
          attributes.fetch(:position)
        end

        #
        # The character that has been typed.
        #
        # @return [string]
        def ch
          attributes.fetch(:ch)
        end

        #
        # The format options.
        #
        # @return [FormattingOptions]
        def options
          attributes.fetch(:options)
        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_params.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/document_on_type_formatting_params.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/document_on_type_formatting_params.rb