Sha256: 101578f37fa595d45b709ce6fbfcf61961700d446351dff7d8b0cc27cf1ed705

Contents?: true

Size: 1008 Bytes

Versions: 8

Compression:

Stored size: 1008 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # The result of a hover request.
      #
      class Hover
        def initialize(contents:, range: nil)
          @attributes = {}

          @attributes[:contents] = contents
          @attributes[:range] = range if range

          @attributes.freeze
        end

        #
        # The hover's content
        #
        # @return [string | MarkupContent | { language: string; value: string; } | MarkedString[]]
        def contents
          attributes.fetch(:contents)
        end

        #
        # An optional range is a range inside a text document
        # that is used to visualize a hover, e.g. by changing the background color.
        #
        # @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

8 entries across 8 versions & 1 rubygems

Version Path
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/hover.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/hover.rb