Sha256: 7d5e46d9792f8adb3b7ecfb4c1a566db6d3a30ba5f51d1113ac235df10bbb8dd

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # A document link is a range in a text document that links to an internal or external resource, like another
      # text document or a web site.
      #
      class DocumentLink
        def initialize(range:, target: nil)
          @attributes = {}

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

          @attributes.freeze
        end

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

        #
        # The uri this link points to. If missing a resolve request is sent later.
        #
        # @return [string]
        def target
          attributes.fetch(:target)
        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

1 entries across 1 versions & 1 rubygems

Version Path
language_server-protocol-0.5.0 lib/language_server/protocol/interface/document_link.rb