Sha256: 9e9b7ef022dfc47a7715ba68df331e81a7909865a4e817b9666a1e11dc1c8d17

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class ColorPresentationParams < PartialResultParams
        def initialize(partial_result_token: nil, text_document:, color:, range:)
          @attributes = {}

          @attributes[:partialResultToken] = partial_result_token if partial_result_token
          @attributes[:textDocument] = text_document
          @attributes[:color] = color
          @attributes[:range] = range

          @attributes.freeze
        end

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

        #
        # The color information to request presentations for.
        #
        # @return [Color]
        def color
          attributes.fetch(:color)
        end

        #
        # The range where the color would be inserted. Serves as a context.
        #
        # @return [Range]
        def range
          attributes.fetch(:range)
        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.16.0.0 lib/language_server/protocol/interface/color_presentation_params.rb
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/color_presentation_params.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/color_presentation_params.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/color_presentation_params.rb