Class: RubyLsp::Requests::DocumentLink

Inherits:
Request
  • Object
show all
Defined in:
lib/ruby_lsp/requests/document_link.rb

Overview

The [document link](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 Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, comments, dispatcher) ⇒ DocumentLink

: (URI::Generic uri, Array comments, Prism::Dispatcher dispatcher) -> void



20
21
22
23
24
25
# File 'lib/ruby_lsp/requests/document_link.rb', line 20

def initialize(uri, comments, dispatcher)
  super()
  @response_builder = ResponseBuilders::CollectionResponseBuilder
    .new #: ResponseBuilders::CollectionResponseBuilder[Interface::DocumentLink]
  Listeners::DocumentLink.new(@response_builder, uri, comments, dispatcher)
end

Class Method Details

.providerObject

: -> Interface::DocumentLinkOptions



14
15
16
# File 'lib/ruby_lsp/requests/document_link.rb', line 14

def provider
  Interface::DocumentLinkOptions.new(resolve_provider: false)
end

Instance Method Details

#performObject

: -> Array



29
30
31
# File 'lib/ruby_lsp/requests/document_link.rb', line 29

def perform
  @response_builder.response
end