ruby-lsp 0.23.11 → 0.23.12

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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/VERSION +1 -1
  4. data/exe/ruby-lsp-launcher +12 -11
  5. data/lib/rubocop/cop/ruby_lsp/use_register_with_handler_method.rb +3 -5
  6. data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +52 -77
  7. data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +61 -144
  8. data/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb +8 -6
  9. data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +73 -182
  10. data/lib/ruby_indexer/lib/ruby_indexer/index.rb +48 -181
  11. data/lib/ruby_indexer/lib/ruby_indexer/location.rb +4 -27
  12. data/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb +12 -14
  13. data/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +21 -44
  14. data/lib/ruby_indexer/lib/ruby_indexer/reference_finder.rb +40 -58
  15. data/lib/ruby_indexer/lib/ruby_indexer/uri.rb +9 -16
  16. data/lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb +5 -9
  17. data/lib/ruby_indexer/test/configuration_test.rb +32 -2
  18. data/lib/ruby_indexer/test/method_test.rb +2 -2
  19. data/lib/ruby_lsp/addon.rb +32 -67
  20. data/lib/ruby_lsp/base_server.rb +10 -10
  21. data/lib/ruby_lsp/client_capabilities.rb +4 -6
  22. data/lib/ruby_lsp/document.rb +21 -32
  23. data/lib/ruby_lsp/erb_document.rb +17 -27
  24. data/lib/ruby_lsp/global_state.rb +30 -32
  25. data/lib/ruby_lsp/internal.rb +2 -0
  26. data/lib/ruby_lsp/listeners/code_lens.rb +21 -39
  27. data/lib/ruby_lsp/listeners/completion.rb +34 -53
  28. data/lib/ruby_lsp/listeners/definition.rb +35 -49
  29. data/lib/ruby_lsp/listeners/document_highlight.rb +60 -69
  30. data/lib/ruby_lsp/listeners/document_link.rb +9 -19
  31. data/lib/ruby_lsp/listeners/document_symbol.rb +34 -48
  32. data/lib/ruby_lsp/listeners/folding_ranges.rb +31 -38
  33. data/lib/ruby_lsp/listeners/hover.rb +37 -47
  34. data/lib/ruby_lsp/listeners/inlay_hints.rb +3 -10
  35. data/lib/ruby_lsp/listeners/semantic_highlighting.rb +29 -35
  36. data/lib/ruby_lsp/listeners/signature_help.rb +4 -23
  37. data/lib/ruby_lsp/listeners/spec_style.rb +199 -0
  38. data/lib/ruby_lsp/listeners/test_style.rb +136 -30
  39. data/lib/ruby_lsp/node_context.rb +8 -35
  40. data/lib/ruby_lsp/rbs_document.rb +7 -5
  41. data/lib/ruby_lsp/requests/code_action_resolve.rb +10 -10
  42. data/lib/ruby_lsp/requests/code_actions.rb +5 -14
  43. data/lib/ruby_lsp/requests/code_lens.rb +4 -13
  44. data/lib/ruby_lsp/requests/completion.rb +4 -15
  45. data/lib/ruby_lsp/requests/completion_resolve.rb +4 -4
  46. data/lib/ruby_lsp/requests/definition.rb +4 -12
  47. data/lib/ruby_lsp/requests/diagnostics.rb +6 -9
  48. data/lib/ruby_lsp/requests/discover_tests.rb +15 -3
  49. data/lib/ruby_lsp/requests/document_highlight.rb +3 -11
  50. data/lib/ruby_lsp/requests/document_link.rb +4 -13
  51. data/lib/ruby_lsp/requests/document_symbol.rb +4 -7
  52. data/lib/ruby_lsp/requests/folding_ranges.rb +4 -7
  53. data/lib/ruby_lsp/requests/formatting.rb +4 -7
  54. data/lib/ruby_lsp/requests/go_to_relevant_file.rb +87 -0
  55. data/lib/ruby_lsp/requests/hover.rb +6 -16
  56. data/lib/ruby_lsp/requests/inlay_hints.rb +4 -13
  57. data/lib/ruby_lsp/requests/on_type_formatting.rb +17 -24
  58. data/lib/ruby_lsp/requests/prepare_rename.rb +3 -8
  59. data/lib/ruby_lsp/requests/prepare_type_hierarchy.rb +4 -13
  60. data/lib/ruby_lsp/requests/range_formatting.rb +3 -4
  61. data/lib/ruby_lsp/requests/references.rb +5 -35
  62. data/lib/ruby_lsp/requests/rename.rb +9 -35
  63. data/lib/ruby_lsp/requests/request.rb +5 -17
  64. data/lib/ruby_lsp/requests/selection_ranges.rb +3 -3
  65. data/lib/ruby_lsp/requests/semantic_highlighting.rb +6 -23
  66. data/lib/ruby_lsp/requests/show_syntax_tree.rb +4 -5
  67. data/lib/ruby_lsp/requests/signature_help.rb +6 -24
  68. data/lib/ruby_lsp/requests/support/annotation.rb +4 -10
  69. data/lib/ruby_lsp/requests/support/common.rb +12 -49
  70. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +12 -14
  71. data/lib/ruby_lsp/requests/support/rubocop_formatter.rb +7 -10
  72. data/lib/ruby_lsp/requests/support/rubocop_runner.rb +9 -15
  73. data/lib/ruby_lsp/requests/support/selection_range.rb +1 -3
  74. data/lib/ruby_lsp/requests/support/sorbet.rb +1 -7
  75. data/lib/ruby_lsp/requests/support/source_uri.rb +5 -16
  76. data/lib/ruby_lsp/requests/support/syntax_tree_formatter.rb +7 -10
  77. data/lib/ruby_lsp/requests/support/test_item.rb +14 -13
  78. data/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb +4 -5
  79. data/lib/ruby_lsp/requests/workspace_symbol.rb +3 -3
  80. data/lib/ruby_lsp/response_builders/collection_response_builder.rb +4 -4
  81. data/lib/ruby_lsp/response_builders/document_symbol.rb +8 -11
  82. data/lib/ruby_lsp/response_builders/hover.rb +5 -5
  83. data/lib/ruby_lsp/response_builders/response_builder.rb +1 -1
  84. data/lib/ruby_lsp/response_builders/semantic_highlighting.rb +18 -40
  85. data/lib/ruby_lsp/response_builders/signature_help.rb +4 -5
  86. data/lib/ruby_lsp/response_builders/test_collection.rb +5 -9
  87. data/lib/ruby_lsp/ruby_document.rb +15 -40
  88. data/lib/ruby_lsp/ruby_lsp_reporter_plugin.rb +106 -0
  89. data/lib/ruby_lsp/scope.rb +6 -10
  90. data/lib/ruby_lsp/server.rb +125 -74
  91. data/lib/ruby_lsp/setup_bundler.rb +22 -15
  92. data/lib/ruby_lsp/store.rb +12 -28
  93. data/lib/ruby_lsp/test_helper.rb +3 -12
  94. data/lib/ruby_lsp/test_reporter.rb +71 -0
  95. data/lib/ruby_lsp/test_unit_test_runner.rb +96 -0
  96. data/lib/ruby_lsp/type_inferrer.rb +9 -13
  97. data/lib/ruby_lsp/utils.rb +27 -65
  98. metadata +8 -3
@@ -44,15 +44,15 @@ module RubyLsp
44
44
  extend T::Sig
45
45
  extend T::Helpers
46
46
 
47
- sig { returns(String) }
47
+ #: String
48
48
  attr_reader :method
49
49
 
50
- sig { returns(Object) }
50
+ #: Object
51
51
  attr_reader :params
52
52
 
53
53
  abstract!
54
54
 
55
- sig { params(method: String, params: Object).void }
55
+ #: (method: String, params: Object) -> void
56
56
  def initialize(method:, params:)
57
57
  @method = method
58
58
  @params = params
@@ -64,9 +64,7 @@ module RubyLsp
64
64
 
65
65
  class Notification < Message
66
66
  class << self
67
- extend T::Sig
68
-
69
- sig { params(message: String, type: Integer).returns(Notification) }
67
+ #: (String message, ?type: Integer) -> Notification
70
68
  def window_show_message(message, type: Constant::MessageType::INFO)
71
69
  new(
72
70
  method: "window/showMessage",
@@ -74,7 +72,7 @@ module RubyLsp
74
72
  )
75
73
  end
76
74
 
77
- sig { params(message: String, type: Integer).returns(Notification) }
75
+ #: (String message, ?type: Integer) -> Notification
78
76
  def window_log_message(message, type: Constant::MessageType::LOG)
79
77
  new(
80
78
  method: "window/logMessage",
@@ -82,7 +80,7 @@ module RubyLsp
82
80
  )
83
81
  end
84
82
 
85
- sig { params(data: T::Hash[Symbol, T.untyped]).returns(Notification) }
83
+ #: (Hash[Symbol, untyped] data) -> Notification
86
84
  def telemetry(data)
87
85
  new(
88
86
  method: "telemetry/event",
@@ -90,14 +88,7 @@ module RubyLsp
90
88
  )
91
89
  end
92
90
 
93
- sig do
94
- params(
95
- id: String,
96
- title: String,
97
- percentage: T.nilable(Integer),
98
- message: T.nilable(String),
99
- ).returns(Notification)
100
- end
91
+ #: (String id, String title, ?percentage: Integer?, ?message: String?) -> Notification
101
92
  def progress_begin(id, title, percentage: nil, message: nil)
102
93
  new(
103
94
  method: "$/progress",
@@ -113,13 +104,7 @@ module RubyLsp
113
104
  )
114
105
  end
115
106
 
116
- sig do
117
- params(
118
- id: String,
119
- percentage: T.nilable(Integer),
120
- message: T.nilable(String),
121
- ).returns(Notification)
122
- end
107
+ #: (String id, ?percentage: Integer?, ?message: String?) -> Notification
123
108
  def progress_report(id, percentage: nil, message: nil)
124
109
  new(
125
110
  method: "$/progress",
@@ -134,7 +119,7 @@ module RubyLsp
134
119
  )
135
120
  end
136
121
 
137
- sig { params(id: String).returns(Notification) }
122
+ #: (String id) -> Notification
138
123
  def progress_end(id)
139
124
  Notification.new(
140
125
  method: "$/progress",
@@ -145,13 +130,7 @@ module RubyLsp
145
130
  )
146
131
  end
147
132
 
148
- sig do
149
- params(
150
- uri: String,
151
- diagnostics: T::Array[Interface::Diagnostic],
152
- version: T.nilable(Integer),
153
- ).returns(Notification)
154
- end
133
+ #: (String uri, Array[Interface::Diagnostic] diagnostics, ?version: Integer?) -> Notification
155
134
  def publish_diagnostics(uri, diagnostics, version: nil)
156
135
  new(
157
136
  method: "textDocument/publishDiagnostics",
@@ -160,9 +139,8 @@ module RubyLsp
160
139
  end
161
140
  end
162
141
 
163
- extend T::Sig
164
-
165
- sig { override.returns(T::Hash[Symbol, T.untyped]) }
142
+ # @override
143
+ #: -> Hash[Symbol, untyped]
166
144
  def to_hash
167
145
  hash = { method: @method }
168
146
  hash[:params] = T.unsafe(@params).to_hash if @params
@@ -171,19 +149,8 @@ module RubyLsp
171
149
  end
172
150
 
173
151
  class Request < Message
174
- extend T::Sig
175
-
176
152
  class << self
177
- extend T::Sig
178
-
179
- sig do
180
- params(
181
- id: Integer,
182
- pattern: T.any(Interface::RelativePattern, String),
183
- kind: Integer,
184
- registration_id: T.nilable(String),
185
- ).returns(Request)
186
- end
153
+ #: (Integer id, (Interface::RelativePattern | String) pattern, ?kind: Integer, ?registration_id: String?) -> Request
187
154
  def register_watched_files(
188
155
  id,
189
156
  pattern,
@@ -210,13 +177,14 @@ module RubyLsp
210
177
  end
211
178
  end
212
179
 
213
- sig { params(id: T.any(Integer, String), method: String, params: Object).void }
180
+ #: (id: (Integer | String), method: String, params: Object) -> void
214
181
  def initialize(id:, method:, params:)
215
182
  @id = id
216
183
  super(method: method, params: params)
217
184
  end
218
185
 
219
- sig { override.returns(T::Hash[Symbol, T.untyped]) }
186
+ # @override
187
+ #: -> Hash[Symbol, untyped]
220
188
  def to_hash
221
189
  hash = { id: @id, method: @method }
222
190
  hash[:params] = T.unsafe(@params).to_hash if @params
@@ -225,15 +193,13 @@ module RubyLsp
225
193
  end
226
194
 
227
195
  class Error
228
- extend T::Sig
229
-
230
- sig { returns(String) }
196
+ #: String
231
197
  attr_reader :message
232
198
 
233
- sig { returns(Integer) }
199
+ #: Integer
234
200
  attr_reader :code
235
201
 
236
- sig { params(id: Integer, code: Integer, message: String, data: T.nilable(T::Hash[Symbol, T.untyped])).void }
202
+ #: (id: Integer, code: Integer, message: String, ?data: Hash[Symbol, untyped]?) -> void
237
203
  def initialize(id:, code:, message:, data: nil)
238
204
  @id = id
239
205
  @code = code
@@ -241,7 +207,7 @@ module RubyLsp
241
207
  @data = data
242
208
  end
243
209
 
244
- sig { returns(T::Hash[Symbol, T.untyped]) }
210
+ #: -> Hash[Symbol, untyped]
245
211
  def to_hash
246
212
  {
247
213
  id: @id,
@@ -256,21 +222,19 @@ module RubyLsp
256
222
 
257
223
  # The final result of running a request before its IO is finalized
258
224
  class Result
259
- extend T::Sig
260
-
261
- sig { returns(T.untyped) }
225
+ #: untyped
262
226
  attr_reader :response
263
227
 
264
- sig { returns(Integer) }
228
+ #: Integer
265
229
  attr_reader :id
266
230
 
267
- sig { params(id: Integer, response: T.untyped).void }
231
+ #: (id: Integer, response: untyped) -> void
268
232
  def initialize(id:, response:)
269
233
  @id = id
270
234
  @response = response
271
235
  end
272
236
 
273
- sig { returns(T::Hash[Symbol, T.untyped]) }
237
+ #: -> Hash[Symbol, untyped]
274
238
  def to_hash
275
239
  { id: @id, result: @response }
276
240
  end
@@ -278,17 +242,15 @@ module RubyLsp
278
242
 
279
243
  # A request configuration, to turn on/off features
280
244
  class RequestConfig
281
- extend T::Sig
282
-
283
- sig { returns(T::Hash[Symbol, T::Boolean]) }
245
+ #: Hash[Symbol, bool]
284
246
  attr_accessor :configuration
285
247
 
286
- sig { params(configuration: T::Hash[Symbol, T::Boolean]).void }
248
+ #: (Hash[Symbol, bool] configuration) -> void
287
249
  def initialize(configuration)
288
250
  @configuration = configuration
289
251
  end
290
252
 
291
- sig { params(feature: Symbol).returns(T.nilable(T::Boolean)) }
253
+ #: (Symbol feature) -> bool?
292
254
  def enabled?(feature)
293
255
  @configuration[:enableAll] || @configuration[feature]
294
256
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.11
4
+ version: 0.23.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-14 00:00:00.000000000 Z
10
+ date: 2025-03-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: language_server-protocol
@@ -140,6 +140,7 @@ files:
140
140
  - lib/ruby_lsp/listeners/inlay_hints.rb
141
141
  - lib/ruby_lsp/listeners/semantic_highlighting.rb
142
142
  - lib/ruby_lsp/listeners/signature_help.rb
143
+ - lib/ruby_lsp/listeners/spec_style.rb
143
144
  - lib/ruby_lsp/listeners/test_style.rb
144
145
  - lib/ruby_lsp/load_sorbet.rb
145
146
  - lib/ruby_lsp/node_context.rb
@@ -157,6 +158,7 @@ files:
157
158
  - lib/ruby_lsp/requests/document_symbol.rb
158
159
  - lib/ruby_lsp/requests/folding_ranges.rb
159
160
  - lib/ruby_lsp/requests/formatting.rb
161
+ - lib/ruby_lsp/requests/go_to_relevant_file.rb
160
162
  - lib/ruby_lsp/requests/hover.rb
161
163
  - lib/ruby_lsp/requests/inlay_hints.rb
162
164
  - lib/ruby_lsp/requests/on_type_formatting.rb
@@ -191,6 +193,7 @@ files:
191
193
  - lib/ruby_lsp/response_builders/signature_help.rb
192
194
  - lib/ruby_lsp/response_builders/test_collection.rb
193
195
  - lib/ruby_lsp/ruby_document.rb
196
+ - lib/ruby_lsp/ruby_lsp_reporter_plugin.rb
194
197
  - lib/ruby_lsp/scope.rb
195
198
  - lib/ruby_lsp/scripts/compose_bundle.rb
196
199
  - lib/ruby_lsp/scripts/compose_bundle_windows.rb
@@ -199,6 +202,8 @@ files:
199
202
  - lib/ruby_lsp/static_docs.rb
200
203
  - lib/ruby_lsp/store.rb
201
204
  - lib/ruby_lsp/test_helper.rb
205
+ - lib/ruby_lsp/test_reporter.rb
206
+ - lib/ruby_lsp/test_unit_test_runner.rb
202
207
  - lib/ruby_lsp/type_inferrer.rb
203
208
  - lib/ruby_lsp/utils.rb
204
209
  - static_docs/yield.md
@@ -222,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
227
  - !ruby/object:Gem::Version
223
228
  version: '0'
224
229
  requirements: []
225
- rubygems_version: 3.6.3
230
+ rubygems_version: 3.6.6
226
231
  specification_version: 4
227
232
  summary: An opinionated language server for Ruby
228
233
  test_files: []