ruby-lsp 0.23.19 → 0.23.20
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63ffbd4bd2ac09693c25c61a71ec89528578c3eaeaf35bf547e5ee748085f3d6
|
4
|
+
data.tar.gz: f3390b3e9f7f86c3dcf98130c04d18a40720ab21a6b521035859bafdac67ae60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0232de2d936eaa8baa579293884fdb47c69d70be87b834b655292111b50ab9609f0d52d2a627a679483919116a6215df25c0966fc725b9c5a11a5b0160f12550
|
7
|
+
data.tar.gz: 3c744d0e29846cc5bf4406a06675fb789d1d6efe959cf982fba2505ca58b151ea45b4c800aceedfd2b242d75e792f557d99ffea5108afdc3894c76d0885ea5ae
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.23.
|
1
|
+
0.23.20
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require "English"
|
4
5
|
require "json"
|
5
6
|
require "socket"
|
6
7
|
require "singleton"
|
@@ -171,6 +172,30 @@ module RubyLsp
|
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
175
|
+
#: -> void
|
176
|
+
def at_coverage_exit
|
177
|
+
coverage_results = gather_coverage_results
|
178
|
+
File.write(File.join(".ruby-lsp", "coverage_result.json"), coverage_results.to_json)
|
179
|
+
internal_shutdown
|
180
|
+
end
|
181
|
+
|
182
|
+
#: -> void
|
183
|
+
def at_exit
|
184
|
+
internal_shutdown unless invoked_shutdown
|
185
|
+
end
|
186
|
+
|
187
|
+
class << self
|
188
|
+
#: -> bool
|
189
|
+
def start_coverage?
|
190
|
+
ENV["RUBY_LSP_TEST_RUNNER"] == "coverage"
|
191
|
+
end
|
192
|
+
|
193
|
+
#: -> bool
|
194
|
+
def executed_under_test_runner?
|
195
|
+
!!(ENV["RUBY_LSP_TEST_RUNNER"] && ENV["RUBY_LSP_ENV"] != "test")
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
174
199
|
private
|
175
200
|
|
176
201
|
#: (String?, **untyped) -> void
|
@@ -181,21 +206,17 @@ module RubyLsp
|
|
181
206
|
end
|
182
207
|
end
|
183
208
|
|
184
|
-
if
|
209
|
+
if RubyLsp::LspReporter.start_coverage?
|
185
210
|
# Auto start coverage when running tests under that profile. This avoids the user from having to configure coverage
|
186
211
|
# manually for their project or adding extra dependencies
|
187
212
|
require "coverage"
|
188
213
|
Coverage.start(:all)
|
214
|
+
end
|
189
215
|
|
216
|
+
if RubyLsp::LspReporter.executed_under_test_runner?
|
190
217
|
at_exit do
|
191
|
-
|
192
|
-
|
193
|
-
RubyLsp::LspReporter.instance.
|
194
|
-
end
|
195
|
-
elsif ENV["RUBY_LSP_TEST_RUNNER"] && ENV["RUBY_LSP_ENV"] != "test"
|
196
|
-
at_exit do
|
197
|
-
# If the test process crashed immediately without finishing the tests, we still need to tell the extension that the
|
198
|
-
# execution ended so that it can clean up
|
199
|
-
RubyLsp::LspReporter.instance.internal_shutdown unless RubyLsp::LspReporter.instance.invoked_shutdown
|
218
|
+
# Regular finish events are registered per test reporter. However, if the test crashes during loading the files
|
219
|
+
# (e.g.: a bad require), we need to ensure that the execution is finalized so that the extension is not left hanging
|
220
|
+
RubyLsp::LspReporter.instance.at_exit if $ERROR_INFO
|
200
221
|
end
|
201
222
|
end
|
@@ -86,3 +86,13 @@ module RubyLsp
|
|
86
86
|
end
|
87
87
|
|
88
88
|
Minitest.extensions << RubyLsp::MinitestReporter
|
89
|
+
|
90
|
+
if RubyLsp::LspReporter.start_coverage?
|
91
|
+
Minitest.after_run do
|
92
|
+
RubyLsp::LspReporter.instance.at_coverage_exit
|
93
|
+
end
|
94
|
+
elsif RubyLsp::LspReporter.executed_under_test_runner?
|
95
|
+
Minitest.after_run do
|
96
|
+
RubyLsp::LspReporter.instance.at_exit
|
97
|
+
end
|
98
|
+
end
|
@@ -59,6 +59,7 @@ module RubyLsp
|
|
59
59
|
|
60
60
|
#: (Float) -> void
|
61
61
|
def finished(elapsed_time)
|
62
|
+
super
|
62
63
|
LspReporter.instance.shutdown
|
63
64
|
end
|
64
65
|
|
@@ -80,3 +81,13 @@ end
|
|
80
81
|
|
81
82
|
Test::Unit::AutoRunner.register_runner(:ruby_lsp) { |_auto_runner| RubyLsp::TestUnitReporter }
|
82
83
|
Test::Unit::AutoRunner.default_runner = :ruby_lsp
|
84
|
+
|
85
|
+
if RubyLsp::LspReporter.start_coverage?
|
86
|
+
Test::Unit.at_exit do
|
87
|
+
RubyLsp::LspReporter.instance.at_coverage_exit
|
88
|
+
end
|
89
|
+
elsif RubyLsp::LspReporter.executed_under_test_runner?
|
90
|
+
Test::Unit.at_exit do
|
91
|
+
RubyLsp::LspReporter.instance.at_exit
|
92
|
+
end
|
93
|
+
end
|