Sha256: 5984e09bfbe1e716f0688d9b92852c0a56c3f5c1723c23edc4ce60e2e9238359

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 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_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/document_link.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/document_link.rb