-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy pathcode_lens.rb
51 lines (43 loc) · 1.36 KB
/
code_lens.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# typed: strict
# frozen_string_literal: true
require "shellwords"
require "ruby_lsp/listeners/code_lens"
module RubyLsp
module Requests
# The
# [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens)
# request informs the editor of runnable commands such as testing and debugging.
class CodeLens < Request
extend T::Sig
class << self
extend T::Sig
sig { returns(Interface::CodeLensOptions) }
def provider
Interface::CodeLensOptions.new(resolve_provider: false)
end
end
sig do
params(
global_state: GlobalState,
uri: URI::Generic,
dispatcher: Prism::Dispatcher,
).void
end
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
sig { override.returns(T::Array[Interface::CodeLens]) }
def perform
@response_builder.response
end
end
end
end