Sha256: eff6b1906c6dfcbc1000c21fa0f2410a6c54a963a3d32221ae89f6b1c542bd1d

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # A document highlight is a range inside a text document which deserves
      # special attention. Usually a document highlight is visualized by changing
      # the background color of its range.
      #
      class DocumentHighlight
        def initialize(range:, kind: nil)
          @attributes = {}

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

          @attributes.freeze
        end

        #
        # The range this highlight applies to.
        #
        # @return [Range]
        def range
          attributes.fetch(:range)
        end

        #
        # The highlight kind, default is DocumentHighlightKind.Text.
        #
        # @return [number]
        def kind
          attributes.fetch(:kind)
        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

9 entries across 9 versions & 1 rubygems

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