ruby-lsp 0.23.15 → 0.23.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +1 -1
- data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +16 -19
- data/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb +0 -3
- data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +9 -19
- data/lib/ruby_indexer/lib/ruby_indexer/index.rb +33 -69
- data/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +1 -10
- data/lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb +4 -4
- data/lib/ruby_indexer/test/index_test.rb +7 -0
- data/lib/ruby_indexer/test/method_test.rb +7 -7
- data/lib/ruby_indexer/test/rbs_indexer_test.rb +4 -3
- data/lib/ruby_indexer/test/test_case.rb +7 -1
- data/lib/ruby_lsp/document.rb +7 -10
- data/lib/ruby_lsp/erb_document.rb +2 -2
- data/lib/ruby_lsp/listeners/completion.rb +8 -8
- data/lib/ruby_lsp/listeners/definition.rb +7 -7
- data/lib/ruby_lsp/listeners/document_link.rb +7 -10
- data/lib/ruby_lsp/listeners/hover.rb +10 -9
- data/lib/ruby_lsp/listeners/signature_help.rb +2 -2
- data/lib/ruby_lsp/listeners/spec_style.rb +11 -11
- data/lib/ruby_lsp/listeners/test_style.rb +15 -10
- data/lib/ruby_lsp/rbs_document.rb +2 -2
- data/lib/ruby_lsp/requests/code_action_resolve.rb +54 -51
- data/lib/ruby_lsp/requests/code_lens.rb +15 -3
- data/lib/ruby_lsp/requests/completion.rb +2 -2
- data/lib/ruby_lsp/requests/definition.rb +3 -4
- data/lib/ruby_lsp/requests/document_highlight.rb +1 -1
- data/lib/ruby_lsp/requests/document_link.rb +1 -1
- data/lib/ruby_lsp/requests/folding_ranges.rb +1 -1
- data/lib/ruby_lsp/requests/go_to_relevant_file.rb +0 -2
- data/lib/ruby_lsp/requests/hover.rb +1 -1
- data/lib/ruby_lsp/requests/inlay_hints.rb +1 -1
- data/lib/ruby_lsp/requests/references.rb +1 -16
- data/lib/ruby_lsp/requests/rename.rb +1 -4
- data/lib/ruby_lsp/requests/request.rb +2 -1
- data/lib/ruby_lsp/requests/selection_ranges.rb +1 -1
- data/lib/ruby_lsp/requests/semantic_highlighting.rb +1 -1
- data/lib/ruby_lsp/requests/show_syntax_tree.rb +1 -1
- data/lib/ruby_lsp/requests/signature_help.rb +1 -1
- data/lib/ruby_lsp/requests/support/annotation.rb +1 -1
- data/lib/ruby_lsp/requests/support/common.rb +0 -5
- data/lib/ruby_lsp/requests/support/source_uri.rb +4 -2
- data/lib/ruby_lsp/requests/support/test_item.rb +6 -0
- data/lib/ruby_lsp/response_builders/document_symbol.rb +1 -1
- data/lib/ruby_lsp/response_builders/test_collection.rb +37 -0
- data/lib/ruby_lsp/ruby_document.rb +4 -34
- data/lib/ruby_lsp/server.rb +38 -22
- data/lib/ruby_lsp/setup_bundler.rb +2 -1
- data/lib/ruby_lsp/store.rb +6 -6
- data/lib/ruby_lsp/test_reporters/lsp_reporter.rb +43 -4
- data/lib/ruby_lsp/utils.rb +55 -2
- metadata +1 -1
data/lib/ruby_lsp/document.rb
CHANGED
@@ -3,14 +3,6 @@
|
|
3
3
|
|
4
4
|
module RubyLsp
|
5
5
|
class Document
|
6
|
-
class LanguageId < T::Enum
|
7
|
-
enums do
|
8
|
-
Ruby = new("ruby")
|
9
|
-
ERB = new("erb")
|
10
|
-
RBS = new("rbs")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
6
|
extend T::Sig
|
15
7
|
extend T::Helpers
|
16
8
|
extend T::Generic
|
@@ -56,8 +48,13 @@ module RubyLsp
|
|
56
48
|
@encoding = global_state.encoding #: Encoding
|
57
49
|
@uri = uri #: URI::Generic
|
58
50
|
@needs_parsing = true #: bool
|
59
|
-
@parse_result = T.unsafe(nil) #: ParseResultType
|
60
51
|
@last_edit = nil #: Edit?
|
52
|
+
|
53
|
+
# Workaround to be able to type parse_result properly. It is immediately set when invoking parse!
|
54
|
+
@parse_result = ( # rubocop:disable Style/RedundantParentheses
|
55
|
+
nil #: as untyped
|
56
|
+
) #: ParseResultType
|
57
|
+
|
61
58
|
parse!
|
62
59
|
end
|
63
60
|
|
@@ -66,7 +63,7 @@ module RubyLsp
|
|
66
63
|
self.class == other.class && uri == other.uri && @source == other.source
|
67
64
|
end
|
68
65
|
|
69
|
-
sig { abstract.returns(
|
66
|
+
sig { abstract.returns(Symbol) }
|
70
67
|
def language_id; end
|
71
68
|
|
72
69
|
#: [T] (String request_name) { (Document[ParseResultType] document) -> T } -> T
|
@@ -50,7 +50,7 @@ module RubyLsp
|
|
50
50
|
"__LINE__",
|
51
51
|
].freeze
|
52
52
|
|
53
|
-
#: (ResponseBuilders::CollectionResponseBuilder[Interface::CompletionItem] response_builder, GlobalState global_state, NodeContext node_context,
|
53
|
+
#: (ResponseBuilders::CollectionResponseBuilder[Interface::CompletionItem] response_builder, GlobalState global_state, NodeContext node_context, SorbetLevel sorbet_level, Prism::Dispatcher dispatcher, URI::Generic uri, String? trigger_character) -> void
|
54
54
|
def initialize( # rubocop:disable Metrics/ParameterLists
|
55
55
|
response_builder,
|
56
56
|
global_state,
|
@@ -100,7 +100,7 @@ module RubyLsp
|
|
100
100
|
def on_constant_read_node_enter(node)
|
101
101
|
# The only scenario where Sorbet doesn't provide constant completion is on ignored files. Even if the file has
|
102
102
|
# no sigil, Sorbet will still provide completion for constants
|
103
|
-
return
|
103
|
+
return unless @sorbet_level.ignore?
|
104
104
|
|
105
105
|
name = RubyIndexer::Index.constant_name(node)
|
106
106
|
return if name.nil?
|
@@ -125,7 +125,7 @@ module RubyLsp
|
|
125
125
|
def on_constant_path_node_enter(node)
|
126
126
|
# The only scenario where Sorbet doesn't provide constant completion is on ignored files. Even if the file has
|
127
127
|
# no sigil, Sorbet will still provide completion for constants
|
128
|
-
return
|
128
|
+
return unless @sorbet_level.ignore?
|
129
129
|
|
130
130
|
name = begin
|
131
131
|
node.full_name
|
@@ -143,7 +143,7 @@ module RubyLsp
|
|
143
143
|
def on_call_node_enter(node)
|
144
144
|
# The only scenario where Sorbet doesn't provide constant completion is on ignored files. Even if the file has
|
145
145
|
# no sigil, Sorbet will still provide completion for constants
|
146
|
-
if @sorbet_level
|
146
|
+
if @sorbet_level.ignore?
|
147
147
|
receiver = node.receiver
|
148
148
|
|
149
149
|
# When writing `Foo::`, the AST assigns a method call node (because you can use that syntax to invoke
|
@@ -390,7 +390,7 @@ module RubyLsp
|
|
390
390
|
def handle_instance_variable_completion(name, location)
|
391
391
|
# Sorbet enforces that all instance variables be declared on typed strict or higher, which means it will be able
|
392
392
|
# to provide all features for them
|
393
|
-
return if @sorbet_level
|
393
|
+
return if @sorbet_level.strict?
|
394
394
|
|
395
395
|
type = @type_inferrer.infer_receiver_type(@node_context)
|
396
396
|
return unless type
|
@@ -475,13 +475,13 @@ module RubyLsp
|
|
475
475
|
def complete_methods(node, name)
|
476
476
|
# If the node has a receiver, then we don't need to provide local nor keyword completions. Sorbet can provide
|
477
477
|
# local and keyword completion for any file with a Sorbet level of true or higher
|
478
|
-
if
|
478
|
+
if !@sorbet_level.true_or_higher? && !node.receiver
|
479
479
|
add_local_completions(node, name)
|
480
480
|
add_keyword_completions(node, name)
|
481
481
|
end
|
482
482
|
|
483
483
|
# Sorbet can provide completion for methods invoked on self on typed true or higher files
|
484
|
-
return if
|
484
|
+
return if @sorbet_level.true_or_higher? && self_receiver?(node)
|
485
485
|
|
486
486
|
type = @type_inferrer.infer_receiver_type(@node_context)
|
487
487
|
return unless type
|
@@ -512,7 +512,7 @@ module RubyLsp
|
|
512
512
|
external_references = @node_context.fully_qualified_name != type.name
|
513
513
|
|
514
514
|
@index.method_completion_candidates(method_name, type.name).each do |entry|
|
515
|
-
next if entry.visibility !=
|
515
|
+
next if entry.visibility != :public && external_references
|
516
516
|
|
517
517
|
entry_name = entry.name
|
518
518
|
owner_name = entry.owner&.name
|
@@ -8,7 +8,7 @@ module RubyLsp
|
|
8
8
|
|
9
9
|
MAX_NUMBER_OF_DEFINITION_CANDIDATES_WITHOUT_RECEIVER = 10
|
10
10
|
|
11
|
-
#: (ResponseBuilders::CollectionResponseBuilder[(Interface::Location | Interface::LocationLink)] response_builder, GlobalState global_state,
|
11
|
+
#: (ResponseBuilders::CollectionResponseBuilder[(Interface::Location | Interface::LocationLink)] response_builder, GlobalState global_state, Symbol language_id, URI::Generic uri, NodeContext node_context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void
|
12
12
|
def initialize(response_builder, global_state, language_id, uri, node_context, dispatcher, sorbet_level) # rubocop:disable Metrics/ParameterLists
|
13
13
|
@response_builder = response_builder
|
14
14
|
@global_state = global_state
|
@@ -53,7 +53,7 @@ module RubyLsp
|
|
53
53
|
#: (Prism::CallNode node) -> void
|
54
54
|
def on_call_node_enter(node)
|
55
55
|
# Sorbet can handle go to definition for methods invoked on self on typed true or higher
|
56
|
-
return if
|
56
|
+
return if @sorbet_level.true_or_higher? && self_receiver?(node)
|
57
57
|
|
58
58
|
message = node.message
|
59
59
|
return unless message
|
@@ -62,7 +62,7 @@ module RubyLsp
|
|
62
62
|
|
63
63
|
# Until we can properly infer the receiver type in erb files (maybe with ruby-lsp-rails),
|
64
64
|
# treating method calls' type as `nil` will allow users to get some completion support first
|
65
|
-
if @language_id ==
|
65
|
+
if @language_id == :erb && inferrer_receiver_type&.name == "Object"
|
66
66
|
inferrer_receiver_type = nil
|
67
67
|
end
|
68
68
|
|
@@ -223,7 +223,7 @@ module RubyLsp
|
|
223
223
|
#: -> void
|
224
224
|
def handle_super_node_definition
|
225
225
|
# Sorbet can handle super hover on typed true or higher
|
226
|
-
return if
|
226
|
+
return if @sorbet_level.true_or_higher?
|
227
227
|
|
228
228
|
surrounding_method = @node_context.surrounding_method
|
229
229
|
return unless surrounding_method
|
@@ -276,7 +276,7 @@ module RubyLsp
|
|
276
276
|
def handle_instance_variable_definition(name)
|
277
277
|
# Sorbet enforces that all instance variables be declared on typed strict or higher, which means it will be able
|
278
278
|
# to provide all features for them
|
279
|
-
return if @sorbet_level
|
279
|
+
return if @sorbet_level.strict?
|
280
280
|
|
281
281
|
type = @type_inferrer.infer_receiver_type(@node_context)
|
282
282
|
return unless type
|
@@ -317,7 +317,7 @@ module RubyLsp
|
|
317
317
|
methods.each do |target_method|
|
318
318
|
uri = target_method.uri
|
319
319
|
full_path = uri.full_path
|
320
|
-
next if
|
320
|
+
next if @sorbet_level.true_or_higher? && (!full_path || not_in_dependencies?(full_path))
|
321
321
|
|
322
322
|
@response_builder << Interface::LocationLink.new(
|
323
323
|
target_uri: uri.to_s,
|
@@ -392,7 +392,7 @@ module RubyLsp
|
|
392
392
|
uri = entry.uri
|
393
393
|
full_path = uri.full_path
|
394
394
|
|
395
|
-
if
|
395
|
+
if !@sorbet_level.ignore? && (!full_path || not_in_dependencies?(full_path))
|
396
396
|
next
|
397
397
|
end
|
398
398
|
|
@@ -105,16 +105,13 @@ module RubyLsp
|
|
105
105
|
match = comment.location.slice.match(%r{source://.*#\d+$})
|
106
106
|
return unless match
|
107
107
|
|
108
|
-
uri =
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end,
|
116
|
-
T.nilable(URI::Source),
|
117
|
-
)
|
108
|
+
uri = begin
|
109
|
+
URI(
|
110
|
+
match[0], #: as !nil
|
111
|
+
)
|
112
|
+
rescue URI::Error
|
113
|
+
nil
|
114
|
+
end #: as URI::Source?
|
118
115
|
return unless uri
|
119
116
|
|
120
117
|
gem_version = resolve_version(uri)
|
@@ -42,7 +42,7 @@ module RubyLsp
|
|
42
42
|
"https://gitlab.com",
|
43
43
|
].freeze #: Array[String]
|
44
44
|
|
45
|
-
#: (ResponseBuilders::Hover response_builder, GlobalState global_state, URI::Generic uri, NodeContext node_context, Prism::Dispatcher dispatcher,
|
45
|
+
#: (ResponseBuilders::Hover response_builder, GlobalState global_state, URI::Generic uri, NodeContext node_context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void
|
46
46
|
def initialize(response_builder, global_state, uri, node_context, dispatcher, sorbet_level) # rubocop:disable Metrics/ParameterLists
|
47
47
|
@response_builder = response_builder
|
48
48
|
@global_state = global_state
|
@@ -96,7 +96,7 @@ module RubyLsp
|
|
96
96
|
|
97
97
|
#: (Prism::ConstantReadNode node) -> void
|
98
98
|
def on_constant_read_node_enter(node)
|
99
|
-
return
|
99
|
+
return unless @sorbet_level.ignore?
|
100
100
|
|
101
101
|
name = RubyIndexer::Index.constant_name(node)
|
102
102
|
return if name.nil?
|
@@ -106,14 +106,14 @@ module RubyLsp
|
|
106
106
|
|
107
107
|
#: (Prism::ConstantWriteNode node) -> void
|
108
108
|
def on_constant_write_node_enter(node)
|
109
|
-
return
|
109
|
+
return unless @sorbet_level.ignore?
|
110
110
|
|
111
111
|
generate_hover(node.name.to_s, node.name_loc)
|
112
112
|
end
|
113
113
|
|
114
114
|
#: (Prism::ConstantPathNode node) -> void
|
115
115
|
def on_constant_path_node_enter(node)
|
116
|
-
return
|
116
|
+
return unless @sorbet_level.ignore?
|
117
117
|
|
118
118
|
name = RubyIndexer::Index.constant_name(node)
|
119
119
|
return if name.nil?
|
@@ -128,7 +128,7 @@ module RubyLsp
|
|
128
128
|
return
|
129
129
|
end
|
130
130
|
|
131
|
-
return if
|
131
|
+
return if @sorbet_level.true_or_higher? && self_receiver?(node)
|
132
132
|
|
133
133
|
message = node.message
|
134
134
|
return unless message
|
@@ -283,7 +283,7 @@ module RubyLsp
|
|
283
283
|
#: -> void
|
284
284
|
def handle_super_node_hover
|
285
285
|
# Sorbet can handle super hover on typed true or higher
|
286
|
-
return if
|
286
|
+
return if @sorbet_level.true_or_higher?
|
287
287
|
|
288
288
|
surrounding_method = @node_context.surrounding_method
|
289
289
|
return unless surrounding_method
|
@@ -318,7 +318,7 @@ module RubyLsp
|
|
318
318
|
def handle_instance_variable_hover(name)
|
319
319
|
# Sorbet enforces that all instance variables be declared on typed strict or higher, which means it will be able
|
320
320
|
# to provide all features for them
|
321
|
-
return if @sorbet_level
|
321
|
+
return if @sorbet_level.strict?
|
322
322
|
|
323
323
|
type = @type_inferrer.infer_receiver_type(@node_context)
|
324
324
|
return unless type
|
@@ -366,9 +366,10 @@ module RubyLsp
|
|
366
366
|
# We should only show hover for private constants if the constant is defined in the same namespace as the
|
367
367
|
# reference
|
368
368
|
first_entry = entries.first #: as !nil
|
369
|
-
|
369
|
+
full_name = first_entry.name
|
370
|
+
return if first_entry.private? && full_name != "#{@node_context.fully_qualified_name}::#{name}"
|
370
371
|
|
371
|
-
categorized_markdown_from_index_entries(
|
372
|
+
categorized_markdown_from_index_entries(full_name, entries).each do |category, content|
|
372
373
|
@response_builder.push(content, category: category)
|
373
374
|
end
|
374
375
|
end
|
@@ -6,7 +6,7 @@ module RubyLsp
|
|
6
6
|
class SignatureHelp
|
7
7
|
include Requests::Support::Common
|
8
8
|
|
9
|
-
#: (ResponseBuilders::SignatureHelp response_builder, GlobalState global_state, NodeContext node_context, Prism::Dispatcher dispatcher,
|
9
|
+
#: (ResponseBuilders::SignatureHelp response_builder, GlobalState global_state, NodeContext node_context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void
|
10
10
|
def initialize(response_builder, global_state, node_context, dispatcher, sorbet_level)
|
11
11
|
@sorbet_level = sorbet_level
|
12
12
|
@response_builder = response_builder
|
@@ -19,7 +19,7 @@ module RubyLsp
|
|
19
19
|
|
20
20
|
#: (Prism::CallNode node) -> void
|
21
21
|
def on_call_node_enter(node)
|
22
|
-
return if
|
22
|
+
return if @sorbet_level.true_or_higher?
|
23
23
|
|
24
24
|
message = node.message
|
25
25
|
return unless message
|
@@ -4,9 +4,7 @@
|
|
4
4
|
module RubyLsp
|
5
5
|
module Listeners
|
6
6
|
class SpecStyle < TestDiscovery
|
7
|
-
|
8
|
-
|
9
|
-
#: (response_builder: ResponseBuilders::TestCollection, global_state: GlobalState, dispatcher: Prism::Dispatcher, uri: URI::Generic) -> void
|
7
|
+
#: (ResponseBuilders::TestCollection, GlobalState, Prism::Dispatcher, URI::Generic) -> void
|
10
8
|
def initialize(response_builder, global_state, dispatcher, uri)
|
11
9
|
super
|
12
10
|
|
@@ -22,7 +20,7 @@ module RubyLsp
|
|
22
20
|
)
|
23
21
|
end
|
24
22
|
|
25
|
-
#: (
|
23
|
+
#: (Prism::ClassNode) -> void
|
26
24
|
def on_class_node_enter(node)
|
27
25
|
with_test_ancestor_tracking(node) do |_, ancestors|
|
28
26
|
is_spec = ancestors.include?("Minitest::Spec")
|
@@ -30,14 +28,14 @@ module RubyLsp
|
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
|
-
#: (
|
31
|
+
#: (Prism::ClassNode) -> void
|
34
32
|
def on_class_node_leave(node) # rubocop:disable RubyLsp/UseRegisterWithHandlerMethod
|
35
33
|
super
|
36
34
|
|
37
35
|
@spec_class_stack.pop
|
38
36
|
end
|
39
37
|
|
40
|
-
#: (
|
38
|
+
#: (Prism::CallNode) -> void
|
41
39
|
def on_call_node_enter(node)
|
42
40
|
case node.name
|
43
41
|
when :describe
|
@@ -47,7 +45,7 @@ module RubyLsp
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
|
-
#: (
|
48
|
+
#: (Prism::CallNode) -> void
|
51
49
|
def on_call_node_leave(node)
|
52
50
|
return unless node.name == :describe && !node.receiver
|
53
51
|
|
@@ -56,7 +54,7 @@ module RubyLsp
|
|
56
54
|
|
57
55
|
private
|
58
56
|
|
59
|
-
#: (
|
57
|
+
#: (Prism::CallNode) -> void
|
60
58
|
def handle_describe(node)
|
61
59
|
return if node.block.nil?
|
62
60
|
|
@@ -74,6 +72,7 @@ module RubyLsp
|
|
74
72
|
framework: :minitest,
|
75
73
|
)
|
76
74
|
@response_builder.add(test_item)
|
75
|
+
@response_builder.add_code_lens(test_item)
|
77
76
|
else
|
78
77
|
add_to_parent_test_group(description, node)
|
79
78
|
end
|
@@ -81,7 +80,7 @@ module RubyLsp
|
|
81
80
|
@describe_block_nesting << description
|
82
81
|
end
|
83
82
|
|
84
|
-
#: (
|
83
|
+
#: (Prism::CallNode) -> void
|
85
84
|
def handle_example(node)
|
86
85
|
return unless in_spec_context?
|
87
86
|
|
@@ -93,7 +92,7 @@ module RubyLsp
|
|
93
92
|
add_to_parent_test_group(description, node)
|
94
93
|
end
|
95
94
|
|
96
|
-
#: (
|
95
|
+
#: (String, Prism::CallNode) -> void
|
97
96
|
def add_to_parent_test_group(description, node)
|
98
97
|
parent_test_group = find_parent_test_group
|
99
98
|
return unless parent_test_group
|
@@ -106,6 +105,7 @@ module RubyLsp
|
|
106
105
|
framework: :minitest,
|
107
106
|
)
|
108
107
|
parent_test_group.add(test_item)
|
108
|
+
@response_builder.add_code_lens(test_item)
|
109
109
|
end
|
110
110
|
|
111
111
|
#: -> Requests::Support::TestItem?
|
@@ -129,7 +129,7 @@ module RubyLsp
|
|
129
129
|
test_group
|
130
130
|
end
|
131
131
|
|
132
|
-
#: (
|
132
|
+
#: (Prism::CallNode) -> String?
|
133
133
|
def extract_description(node)
|
134
134
|
first_argument = node.arguments&.arguments&.first
|
135
135
|
return unless first_argument
|
@@ -93,9 +93,9 @@ module RubyLsp
|
|
93
93
|
if examples.empty?
|
94
94
|
"^#{group_regex}(#|::)"
|
95
95
|
elsif examples.length == 1
|
96
|
-
"^#{group_regex}##{examples[0]}
|
96
|
+
"^#{group_regex}##{examples[0]}\\$"
|
97
97
|
else
|
98
|
-
"^#{group_regex}#(#{examples.join("|")})
|
98
|
+
"^#{group_regex}#(#{examples.join("|")})\\$"
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -116,13 +116,13 @@ module RubyLsp
|
|
116
116
|
Shellwords.escape(TestDiscovery::DYNAMIC_REFERENCE_MARKER),
|
117
117
|
".*",
|
118
118
|
)
|
119
|
-
command = +"#{BASE_COMMAND} -Itest #{file_path} --testcase \"/^#{group_regex}
|
119
|
+
command = +"#{BASE_COMMAND} -Itest #{file_path} --testcase \"/^#{group_regex}\\$/\""
|
120
120
|
|
121
121
|
unless examples.empty?
|
122
122
|
command << if examples.length == 1
|
123
|
-
" --name \"/#{examples[0]}
|
123
|
+
" --name \"/#{examples[0]}\\$/\""
|
124
124
|
else
|
125
|
-
" --name \"/(#{examples.join("|")})
|
125
|
+
" --name \"/(#{examples.join("|")})\\$/\""
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -143,7 +143,7 @@ module RubyLsp
|
|
143
143
|
"ruby"
|
144
144
|
end #: String
|
145
145
|
|
146
|
-
#: (ResponseBuilders::TestCollection
|
146
|
+
#: (ResponseBuilders::TestCollection, GlobalState, Prism::Dispatcher, URI::Generic) -> void
|
147
147
|
def initialize(response_builder, global_state, dispatcher, uri)
|
148
148
|
super
|
149
149
|
|
@@ -165,13 +165,16 @@ module RubyLsp
|
|
165
165
|
@framework = :test_unit if ancestors.include?("Test::Unit::TestCase")
|
166
166
|
|
167
167
|
if @framework == :test_unit || non_declarative_minitest?(ancestors, name)
|
168
|
-
|
168
|
+
test_item = Requests::Support::TestItem.new(
|
169
169
|
name,
|
170
170
|
name,
|
171
171
|
@uri,
|
172
172
|
range_from_node(node),
|
173
173
|
framework: @framework,
|
174
|
-
)
|
174
|
+
)
|
175
|
+
|
176
|
+
@response_builder.add(test_item)
|
177
|
+
@response_builder.add_code_lens(test_item)
|
175
178
|
end
|
176
179
|
end
|
177
180
|
end
|
@@ -191,13 +194,15 @@ module RubyLsp
|
|
191
194
|
test_item = @response_builder[current_group_name]
|
192
195
|
return unless test_item
|
193
196
|
|
194
|
-
|
197
|
+
example_item = Requests::Support::TestItem.new(
|
195
198
|
"#{current_group_name}##{name}",
|
196
199
|
name,
|
197
200
|
@uri,
|
198
201
|
range_from_node(node),
|
199
202
|
framework: @framework,
|
200
|
-
)
|
203
|
+
)
|
204
|
+
test_item.add(example_item)
|
205
|
+
@response_builder.add_code_lens(test_item)
|
201
206
|
end
|
202
207
|
|
203
208
|
#: (Prism::CallNode node) -> void
|