Sha256: 44100628702879709a0f81d79d5a7760d81ae92b3543e6bbf46045bd54662408

Contents?: true

Size: 1.33 KB

Versions: 22

Compression:

Stored size: 1.33 KB

Contents

# typed: strict
# frozen_string_literal: true

require "ruby_lsp/listeners/document_link"

module RubyLsp
  module Requests
    # The [document link](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentLink)
    # makes `# source://PATH_TO_FILE#line` comments in a Ruby/RBI file clickable if the file exists.
    # When the user clicks the link, it'll open that location.
    class DocumentLink < Request
      extend T::Sig

      class << self
        extend T::Sig

        sig { returns(Interface::DocumentLinkOptions) }
        def provider
          Interface::DocumentLinkOptions.new(resolve_provider: false)
        end
      end

      sig do
        params(
          uri: URI::Generic,
          comments: T::Array[Prism::Comment],
          dispatcher: Prism::Dispatcher,
        ).void
      end
      def initialize(uri, comments, dispatcher)
        super()
        @response_builder = T.let(
          ResponseBuilders::CollectionResponseBuilder[Interface::DocumentLink].new,
          ResponseBuilders::CollectionResponseBuilder[Interface::DocumentLink],
        )
        Listeners::DocumentLink.new(@response_builder, uri, comments, dispatcher)
      end

      sig { override.returns(T::Array[Interface::DocumentLink]) }
      def perform
        @response_builder.response
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ruby-lsp-0.23.6 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.5 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.4 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.3 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.2 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.1 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.23.0 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.22.1 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.22.0 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.21.3 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.21.2 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.21.1 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.21.0 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.20.1 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.20.0 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.19.1 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.19.0 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.18.4 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.18.3 lib/ruby_lsp/requests/document_link.rb
ruby-lsp-0.18.2 lib/ruby_lsp/requests/document_link.rb