ruby-lsp-rails 0.4.2 → 0.4.3
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: 164043cff79bd96fb8d2db4cdc17bc38eb9ae8961a47d025ff876d1de7506527
|
4
|
+
data.tar.gz: 2270c6c26b9e38896add0e73ad263800907de59779003957b5f87cb57a7051d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6b0115be4ed91883daadd10f2fdf1cc531264dee8ae62f50feb72b5ee5d0caa97e83cb2092d2bc2165f1788b6e08c52dc227a2dbcbc71d9f7740d3fec431fc
|
7
|
+
data.tar.gz: 65012c96ae44392d278d53a72e094fc2d75c10b864c643087186113b2490b42f483d6660f7af170a5479ae37ce533ae85af5411439bdcfe0ae8c80f66c75c35b
|
@@ -75,7 +75,7 @@ module RubyLsp
|
|
75
75
|
include Requests::Support::Common
|
76
76
|
include ActiveSupportTestCaseHelper
|
77
77
|
|
78
|
-
#: (RunnerClient
|
78
|
+
#: (RunnerClient, GlobalState, ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens], URI::Generic, Prism::Dispatcher) -> void
|
79
79
|
def initialize(client, global_state, response_builder, uri, dispatcher)
|
80
80
|
@client = client
|
81
81
|
@global_state = global_state
|
@@ -98,8 +98,10 @@ module RubyLsp
|
|
98
98
|
|
99
99
|
#: (Prism::CallNode node) -> void
|
100
100
|
def on_call_node_enter(node)
|
101
|
-
|
101
|
+
# Remove this method once the rollout is complete
|
102
|
+
return if @global_state.enabled_feature?(:fullTestDiscovery)
|
102
103
|
|
104
|
+
content = extract_test_case_name(node)
|
103
105
|
return unless content
|
104
106
|
|
105
107
|
line_number = node.location.start_line
|
@@ -110,12 +112,15 @@ module RubyLsp
|
|
110
112
|
# Although uncommon, Rails tests can be written with the classic "def test_name" syntax.
|
111
113
|
#: (Prism::DefNode node) -> void
|
112
114
|
def on_def_node_enter(node)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
# Remove this entire unless block once the rollout is complete
|
116
|
+
unless @global_state.enabled_feature?(:fullTestDiscovery)
|
117
|
+
method_name = node.name.to_s
|
118
|
+
|
119
|
+
if method_name.start_with?("test_")
|
120
|
+
line_number = node.location.start_line
|
121
|
+
command = "#{test_command} #{@path}:#{line_number}"
|
122
|
+
add_test_code_lens(node, name: method_name, command: command, kind: :example)
|
123
|
+
end
|
119
124
|
end
|
120
125
|
|
121
126
|
if controller?
|
@@ -134,7 +139,8 @@ module RubyLsp
|
|
134
139
|
# back in a controller context. This part is used in other places in the LSP
|
135
140
|
@constant_name_stack << [class_name, superclass_name]
|
136
141
|
|
137
|
-
if
|
142
|
+
# Remove this entire if block once the rollout is complete
|
143
|
+
if class_name.end_with?("Test") && !@global_state.enabled_feature?(:fullTestDiscovery)
|
138
144
|
fully_qualified_name = @constant_name_stack.map(&:first).join("::")
|
139
145
|
command = "#{test_command} #{@path} --name \"/#{Shellwords.escape(fully_qualified_name)}(#|::)/\""
|
140
146
|
add_test_code_lens(node, name: class_name, command: command, kind: :group)
|
@@ -155,6 +161,8 @@ module RubyLsp
|
|
155
161
|
if class_name.end_with?("Test")
|
156
162
|
@group_id_stack.pop
|
157
163
|
end
|
164
|
+
# Remove everything but the `@constant_name_stack.pop` once the rollout is complete
|
165
|
+
return if @global_state.enabled_feature?(:fullTestDiscovery)
|
158
166
|
|
159
167
|
@constant_name_stack.pop
|
160
168
|
end
|
@@ -75,6 +75,7 @@ module RubyLsp
|
|
75
75
|
)
|
76
76
|
|
77
77
|
@response_builder.add(test_item)
|
78
|
+
@response_builder.add_code_lens(test_item)
|
78
79
|
end
|
79
80
|
end
|
80
81
|
end
|
@@ -127,13 +128,15 @@ module RubyLsp
|
|
127
128
|
test_item = group_test_item
|
128
129
|
return unless test_item
|
129
130
|
|
130
|
-
|
131
|
+
example_item = Requests::Support::TestItem.new(
|
131
132
|
"#{test_item.id}##{test_name}",
|
132
133
|
test_name,
|
133
134
|
@uri,
|
134
135
|
range_from_node(node),
|
135
136
|
framework: :rails,
|
136
|
-
)
|
137
|
+
)
|
138
|
+
test_item.add(example_item)
|
139
|
+
@response_builder.add_code_lens(example_item)
|
137
140
|
end
|
138
141
|
|
139
142
|
#: -> Requests::Support::TestItem?
|
@@ -17,7 +17,7 @@ module RubyLsp
|
|
17
17
|
@supports_progress = supports_progress
|
18
18
|
end
|
19
19
|
|
20
|
-
#: (percentage: Integer?, message: String?) -> void
|
20
|
+
#: (?percentage: Integer?, ?message: String?) -> void
|
21
21
|
def report(percentage: nil, message: nil)
|
22
22
|
return unless @supports_progress
|
23
23
|
return unless percentage || message
|
@@ -40,7 +40,7 @@ module RubyLsp
|
|
40
40
|
|
41
41
|
# Log a message to the editor's output panel. The type is the number of the message type, which can be found in
|
42
42
|
# the specification https://microsoft.github.io/language-server-protocol/specification/#messageType
|
43
|
-
#: (String, type: Integer) -> void
|
43
|
+
#: (String, ?type: Integer) -> void
|
44
44
|
def log_message(message, type: 4)
|
45
45
|
send_notification({ method: "window/logMessage", params: { type: type, message: message } })
|
46
46
|
end
|
@@ -86,7 +86,7 @@ module RubyLsp
|
|
86
86
|
log_message("Request #{notification_name} failed:\n#{e.full_message(highlight: false)}")
|
87
87
|
end
|
88
88
|
|
89
|
-
#: (String, String, percentage: Integer?, message: String?) -> void
|
89
|
+
#: (String, String, ?percentage: Integer?, ?message: String?) -> void
|
90
90
|
def begin_progress(id, title, percentage: nil, message: nil)
|
91
91
|
return unless capabilities[:supports_progress]
|
92
92
|
|
@@ -112,7 +112,7 @@ module RubyLsp
|
|
112
112
|
})
|
113
113
|
end
|
114
114
|
|
115
|
-
#: (String, percentage: Integer?, message: String?) -> void
|
115
|
+
#: (String, ?percentage: Integer?, ?message: String?) -> void
|
116
116
|
def report_progress(id, percentage: nil, message: nil)
|
117
117
|
return unless capabilities[:supports_progress]
|
118
118
|
|
@@ -142,7 +142,7 @@ module RubyLsp
|
|
142
142
|
})
|
143
143
|
end
|
144
144
|
|
145
|
-
#: (String, String, percentage: Integer?, message: String?) { (Progress) -> void } -> void
|
145
|
+
#: (String, String, ?percentage: Integer?, ?message: String?) { (Progress) -> void } -> void
|
146
146
|
def with_progress(id, title, percentage: nil, message: nil, &block)
|
147
147
|
progress_block = Progress.new(stderr, id, capabilities[:supports_progress])
|
148
148
|
return block.call(progress_block) unless capabilities[:supports_progress]
|
@@ -231,12 +231,12 @@ module RubyLsp
|
|
231
231
|
end
|
232
232
|
|
233
233
|
class IOWrapper < SimpleDelegator
|
234
|
-
#: (untyped) -> void
|
234
|
+
#: (*untyped) -> void
|
235
235
|
def puts(*args)
|
236
236
|
args.each { |arg| log("#{arg}\n") }
|
237
237
|
end
|
238
238
|
|
239
|
-
#: (untyped) -> void
|
239
|
+
#: (*untyped) -> void
|
240
240
|
def print(*args)
|
241
241
|
args.each { |arg| log(arg.to_s) }
|
242
242
|
end
|
@@ -255,7 +255,7 @@ module RubyLsp
|
|
255
255
|
class Server < ServerComponent
|
256
256
|
include Common
|
257
257
|
|
258
|
-
#: (IO | StringIO, IO | StringIO, bool, Hash[Symbol | String, untyped]) -> void
|
258
|
+
#: (?stdout: IO | StringIO, ?stderr: IO | StringIO, ?override_default_output_device: bool, ?capabilities: Hash[Symbol | String, untyped]) -> void
|
259
259
|
def initialize(stdout: $stdout, stderr: $stderr, override_default_output_device: true, capabilities: {})
|
260
260
|
# Grab references to the original pipes so that we can change the default output device further down
|
261
261
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
@@ -15,7 +15,7 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.23.
|
18
|
+
version: 0.23.18
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 0.24.0
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.23.
|
28
|
+
version: 0.23.18
|
29
29
|
- - "<"
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: 0.24.0
|