Class: RubyLsp::Requests::CodeLens

Inherits:
Request
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ruby_lsp/requests/code_lens.rb

Overview

![Code lens demo](../../code_lens.gif)

The [code lens](microsoft.github.io/language-server-protocol/specification#textDocument_codeLens) request informs the editor of runnable commands such as testing and debugging

# Example

“‘ruby # Run | Run in Terminal | Debug class Test < Minitest::Test end “`

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_state, uri, dispatcher) ⇒ CodeLens

Returns a new instance of CodeLens.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ruby_lsp/requests/code_lens.rb', line 42

def initialize(global_state, uri, dispatcher)
  @response_builder = T.let(
    ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens].new,
    ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens],
  )
  super()
  Listeners::CodeLens.new(@response_builder, global_state, uri, dispatcher)

  Addon.addons.each do |addon|
    addon.create_code_lens_listener(@response_builder, uri, dispatcher)
  end
end

Class Method Details

.providerObject



30
31
32
# File 'lib/ruby_lsp/requests/code_lens.rb', line 30

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

Instance Method Details

#performObject



56
57
58
# File 'lib/ruby_lsp/requests/code_lens.rb', line 56

def perform
  @response_builder.response
end