solargraph 0.58.3 → 0.60.0

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 (238) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +3 -0
  3. data/.github/workflows/linting.yml +12 -5
  4. data/.github/workflows/plugins.yml +54 -34
  5. data/.github/workflows/rspec.yml +18 -28
  6. data/.github/workflows/typecheck.yml +6 -3
  7. data/.rubocop.yml +39 -6
  8. data/.rubocop_todo.yml +53 -966
  9. data/CHANGELOG.md +35 -0
  10. data/Gemfile +6 -1
  11. data/README.md +3 -3
  12. data/Rakefile +26 -23
  13. data/bin/solargraph +2 -1
  14. data/lib/solargraph/api_map/cache.rb +3 -3
  15. data/lib/solargraph/api_map/constants.rb +12 -3
  16. data/lib/solargraph/api_map/index.rb +42 -20
  17. data/lib/solargraph/api_map/source_to_yard.rb +22 -9
  18. data/lib/solargraph/api_map/store.rb +61 -36
  19. data/lib/solargraph/api_map.rb +192 -78
  20. data/lib/solargraph/bench.rb +2 -3
  21. data/lib/solargraph/complex_type/conformance.rb +176 -0
  22. data/lib/solargraph/complex_type/type_methods.rb +31 -18
  23. data/lib/solargraph/complex_type/unique_type.rb +225 -63
  24. data/lib/solargraph/complex_type.rb +177 -59
  25. data/lib/solargraph/convention/active_support_concern.rb +111 -111
  26. data/lib/solargraph/convention/base.rb +50 -50
  27. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +1 -1
  28. data/lib/solargraph/convention/data_definition/data_definition_node.rb +7 -5
  29. data/lib/solargraph/convention/data_definition.rb +5 -2
  30. data/lib/solargraph/convention/gemfile.rb +1 -1
  31. data/lib/solargraph/convention/gemspec.rb +1 -1
  32. data/lib/solargraph/convention/rakefile.rb +1 -1
  33. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +2 -1
  34. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +4 -3
  35. data/lib/solargraph/convention/struct_definition.rb +8 -4
  36. data/lib/solargraph/convention.rb +2 -2
  37. data/lib/solargraph/converters/dd.rb +2 -0
  38. data/lib/solargraph/converters/dl.rb +2 -0
  39. data/lib/solargraph/converters/dt.rb +2 -0
  40. data/lib/solargraph/converters/misc.rb +2 -0
  41. data/lib/solargraph/diagnostics/require_not_found.rb +1 -0
  42. data/lib/solargraph/diagnostics/rubocop.rb +11 -10
  43. data/lib/solargraph/diagnostics/rubocop_helpers.rb +5 -3
  44. data/lib/solargraph/diagnostics/type_check.rb +11 -10
  45. data/lib/solargraph/diagnostics/update_errors.rb +4 -8
  46. data/lib/solargraph/diagnostics.rb +55 -55
  47. data/lib/solargraph/doc_map.rb +39 -39
  48. data/lib/solargraph/environ.rb +52 -52
  49. data/lib/solargraph/equality.rb +4 -4
  50. data/lib/solargraph/gem_pins.rb +4 -15
  51. data/lib/solargraph/language_server/error_codes.rb +10 -10
  52. data/lib/solargraph/language_server/host/diagnoser.rb +1 -1
  53. data/lib/solargraph/language_server/host/dispatch.rb +3 -3
  54. data/lib/solargraph/language_server/host/message_worker.rb +4 -3
  55. data/lib/solargraph/language_server/host/sources.rb +2 -1
  56. data/lib/solargraph/language_server/host.rb +35 -28
  57. data/lib/solargraph/language_server/message/base.rb +1 -1
  58. data/lib/solargraph/language_server/message/client/register_capability.rb +1 -3
  59. data/lib/solargraph/language_server/message/completion_item/resolve.rb +6 -8
  60. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +12 -18
  61. data/lib/solargraph/language_server/message/extended/document.rb +1 -0
  62. data/lib/solargraph/language_server/message/extended/document_gems.rb +7 -7
  63. data/lib/solargraph/language_server/message/extended/download_core.rb +2 -1
  64. data/lib/solargraph/language_server/message/extended/environment.rb +25 -25
  65. data/lib/solargraph/language_server/message/extended/search.rb +1 -1
  66. data/lib/solargraph/language_server/message/initialize.rb +20 -14
  67. data/lib/solargraph/language_server/message/initialized.rb +28 -28
  68. data/lib/solargraph/language_server/message/text_document/completion.rb +10 -8
  69. data/lib/solargraph/language_server/message/text_document/definition.rb +41 -32
  70. data/lib/solargraph/language_server/message/text_document/document_highlight.rb +17 -10
  71. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +29 -19
  72. data/lib/solargraph/language_server/message/text_document/formatting.rb +8 -6
  73. data/lib/solargraph/language_server/message/text_document/hover.rb +5 -5
  74. data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +13 -6
  75. data/lib/solargraph/language_server/message/text_document/references.rb +17 -10
  76. data/lib/solargraph/language_server/message/text_document/rename.rb +20 -13
  77. data/lib/solargraph/language_server/message/text_document/signature_help.rb +3 -2
  78. data/lib/solargraph/language_server/message/text_document/type_definition.rb +25 -17
  79. data/lib/solargraph/language_server/message/text_document.rb +28 -28
  80. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +34 -28
  81. data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +38 -30
  82. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +23 -17
  83. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +27 -17
  84. data/lib/solargraph/language_server/message.rb +1 -1
  85. data/lib/solargraph/language_server/progress.rb +143 -143
  86. data/lib/solargraph/language_server/request.rb +4 -2
  87. data/lib/solargraph/language_server/transport/adapter.rb +68 -68
  88. data/lib/solargraph/language_server/transport/data_reader.rb +11 -13
  89. data/lib/solargraph/language_server/uri_helpers.rb +2 -2
  90. data/lib/solargraph/language_server.rb +20 -20
  91. data/lib/solargraph/library.rb +57 -38
  92. data/lib/solargraph/location.rb +17 -14
  93. data/lib/solargraph/logging.rb +22 -4
  94. data/lib/solargraph/page.rb +1 -1
  95. data/lib/solargraph/parser/comment_ripper.rb +19 -4
  96. data/lib/solargraph/parser/flow_sensitive_typing.rb +324 -108
  97. data/lib/solargraph/parser/node_processor/base.rb +34 -4
  98. data/lib/solargraph/parser/node_processor.rb +8 -7
  99. data/lib/solargraph/parser/parser_gem/class_methods.rb +30 -14
  100. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +1 -1
  101. data/lib/solargraph/parser/parser_gem/node_chainer.rb +51 -25
  102. data/lib/solargraph/parser/parser_gem/node_methods.rb +222 -72
  103. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +24 -24
  104. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +4 -4
  105. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +13 -11
  106. data/lib/solargraph/parser/parser_gem/node_processors/begin_node.rb +9 -0
  107. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +11 -12
  108. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +36 -36
  109. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +24 -24
  110. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +10 -3
  111. data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +9 -8
  112. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +24 -24
  113. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +36 -6
  114. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +5 -3
  115. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +1 -0
  116. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +3 -1
  117. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +64 -40
  118. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +3 -3
  119. data/lib/solargraph/parser/parser_gem/node_processors/or_node.rb +22 -0
  120. data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +1 -1
  121. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +2 -1
  122. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +4 -5
  123. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +124 -113
  124. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +20 -20
  125. data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +1 -1
  126. data/lib/solargraph/parser/parser_gem/node_processors/when_node.rb +23 -0
  127. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +6 -2
  128. data/lib/solargraph/parser/parser_gem/node_processors.rb +4 -0
  129. data/lib/solargraph/parser/parser_gem.rb +2 -0
  130. data/lib/solargraph/parser/region.rb +9 -3
  131. data/lib/solargraph/parser/snippet.rb +3 -1
  132. data/lib/solargraph/parser.rb +2 -0
  133. data/lib/solargraph/pin/base.rb +156 -84
  134. data/lib/solargraph/pin/base_variable.rb +273 -24
  135. data/lib/solargraph/pin/block.rb +29 -6
  136. data/lib/solargraph/pin/breakable.rb +7 -1
  137. data/lib/solargraph/pin/callable.rb +67 -23
  138. data/lib/solargraph/pin/closure.rb +7 -10
  139. data/lib/solargraph/pin/common.rb +36 -6
  140. data/lib/solargraph/pin/compound_statement.rb +55 -0
  141. data/lib/solargraph/pin/constant.rb +3 -5
  142. data/lib/solargraph/pin/conversions.rb +10 -4
  143. data/lib/solargraph/pin/delegated_method.rb +19 -8
  144. data/lib/solargraph/pin/documenting.rb +4 -2
  145. data/lib/solargraph/pin/instance_variable.rb +5 -1
  146. data/lib/solargraph/pin/keyword.rb +0 -4
  147. data/lib/solargraph/pin/local_variable.rb +15 -59
  148. data/lib/solargraph/pin/method.rb +205 -111
  149. data/lib/solargraph/pin/method_alias.rb +8 -0
  150. data/lib/solargraph/pin/namespace.rb +19 -12
  151. data/lib/solargraph/pin/parameter.rb +102 -36
  152. data/lib/solargraph/pin/proxy_type.rb +4 -1
  153. data/lib/solargraph/pin/reference/override.rb +1 -1
  154. data/lib/solargraph/pin/reference/require.rb +14 -14
  155. data/lib/solargraph/pin/reference/superclass.rb +2 -0
  156. data/lib/solargraph/pin/reference/type_alias.rb +16 -0
  157. data/lib/solargraph/pin/reference.rb +20 -0
  158. data/lib/solargraph/pin/search.rb +8 -7
  159. data/lib/solargraph/pin/signature.rb +15 -12
  160. data/lib/solargraph/pin/singleton.rb +11 -11
  161. data/lib/solargraph/pin/symbol.rb +2 -1
  162. data/lib/solargraph/pin/until.rb +2 -4
  163. data/lib/solargraph/pin/while.rb +2 -4
  164. data/lib/solargraph/pin.rb +2 -0
  165. data/lib/solargraph/pin_cache.rb +22 -19
  166. data/lib/solargraph/position.rb +17 -10
  167. data/lib/solargraph/range.rb +16 -15
  168. data/lib/solargraph/rbs_map/conversions.rb +278 -191
  169. data/lib/solargraph/rbs_map/core_fills.rb +18 -11
  170. data/lib/solargraph/rbs_map/core_map.rb +24 -17
  171. data/lib/solargraph/rbs_map/stdlib_map.rb +33 -5
  172. data/lib/solargraph/rbs_map.rb +76 -32
  173. data/lib/solargraph/rbs_translator.rb +206 -0
  174. data/lib/solargraph/server_methods.rb +1 -1
  175. data/lib/solargraph/shell.rb +330 -71
  176. data/lib/solargraph/source/chain/array.rb +3 -12
  177. data/lib/solargraph/source/chain/block_symbol.rb +13 -13
  178. data/lib/solargraph/source/chain/block_variable.rb +13 -13
  179. data/lib/solargraph/source/chain/call.rb +91 -119
  180. data/lib/solargraph/source/chain/class_variable.rb +1 -1
  181. data/lib/solargraph/source/chain/constant.rb +5 -1
  182. data/lib/solargraph/source/chain/global_variable.rb +1 -1
  183. data/lib/solargraph/source/chain/hash.rb +8 -5
  184. data/lib/solargraph/source/chain/head.rb +19 -19
  185. data/lib/solargraph/source/chain/if.rb +12 -10
  186. data/lib/solargraph/source/chain/instance_variable.rb +24 -1
  187. data/lib/solargraph/source/chain/link.rb +12 -22
  188. data/lib/solargraph/source/chain/literal.rb +22 -15
  189. data/lib/solargraph/source/chain/or.rb +10 -4
  190. data/lib/solargraph/source/chain/q_call.rb +2 -0
  191. data/lib/solargraph/source/chain/variable.rb +3 -1
  192. data/lib/solargraph/source/chain/z_super.rb +1 -3
  193. data/lib/solargraph/source/chain.rb +51 -38
  194. data/lib/solargraph/source/change.rb +12 -5
  195. data/lib/solargraph/source/cursor.rb +33 -18
  196. data/lib/solargraph/source/encoding_fixes.rb +6 -7
  197. data/lib/solargraph/source/source_chainer.rb +56 -32
  198. data/lib/solargraph/source/updater.rb +5 -1
  199. data/lib/solargraph/source.rb +59 -35
  200. data/lib/solargraph/source_map/clip.rb +54 -30
  201. data/lib/solargraph/source_map/data.rb +4 -1
  202. data/lib/solargraph/source_map/mapper.rb +28 -131
  203. data/lib/solargraph/source_map.rb +35 -9
  204. data/lib/solargraph/type_checker/problem.rb +3 -1
  205. data/lib/solargraph/type_checker/rules.rb +81 -8
  206. data/lib/solargraph/type_checker.rb +196 -122
  207. data/lib/solargraph/version.rb +19 -1
  208. data/lib/solargraph/workspace/config.rb +14 -11
  209. data/lib/solargraph/workspace/gemspecs.rb +367 -0
  210. data/lib/solargraph/workspace/require_paths.rb +1 -0
  211. data/lib/solargraph/workspace.rb +50 -28
  212. data/lib/solargraph/yard_map/cache.rb +25 -25
  213. data/lib/solargraph/yard_map/directives/attribute_directive.rb +65 -0
  214. data/lib/solargraph/yard_map/directives/domain_directive.rb +30 -0
  215. data/lib/solargraph/yard_map/directives/method_directive.rb +51 -0
  216. data/lib/solargraph/yard_map/directives/override_directive.rb +30 -0
  217. data/lib/solargraph/yard_map/directives/parse_directive.rb +53 -0
  218. data/lib/solargraph/yard_map/directives/visibility_directive.rb +70 -0
  219. data/lib/solargraph/yard_map/directives.rb +35 -0
  220. data/lib/solargraph/yard_map/helpers.rb +8 -3
  221. data/lib/solargraph/yard_map/macro.rb +113 -0
  222. data/lib/solargraph/yard_map/mapper/to_constant.rb +28 -28
  223. data/lib/solargraph/yard_map/mapper/to_method.rb +13 -7
  224. data/lib/solargraph/yard_map/mapper/to_namespace.rb +2 -1
  225. data/lib/solargraph/yard_map/mapper.rb +31 -8
  226. data/lib/solargraph/yard_map.rb +19 -18
  227. data/lib/solargraph/yard_tags.rb +2 -2
  228. data/lib/solargraph/yardoc.rb +7 -4
  229. data/lib/solargraph.rb +34 -10
  230. data/rbs/fills/rubygems/0/dependency.rbs +193 -0
  231. data/rbs/shims/ast/0/node.rbs +1 -1
  232. data/rbs/shims/diff-lcs/1.5/diff-lcs.rbs +11 -0
  233. data/solargraph.gemspec +38 -35
  234. metadata +64 -42
  235. data/lib/solargraph/type_checker/checks.rb +0 -124
  236. data/lib/solargraph/type_checker/param_def.rb +0 -37
  237. data/lib/solargraph/yard_map/to_method.rb +0 -89
  238. data/rbs/fills/tuple/tuple.rbs +0 -149
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.58.3
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-03-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ast
@@ -156,33 +156,33 @@ dependencies:
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0.1'
158
158
  - !ruby/object:Gem::Dependency
159
- name: ostruct
159
+ name: open3
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
- version: '0.6'
164
+ version: 0.2.1
165
165
  type: :runtime
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - "~>"
170
170
  - !ruby/object:Gem::Version
171
- version: '0.6'
171
+ version: 0.2.1
172
172
  - !ruby/object:Gem::Dependency
173
- name: open3
173
+ name: ostruct
174
174
  requirement: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: 0.2.1
178
+ version: '0.6'
179
179
  type: :runtime
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - "~>"
184
184
  - !ruby/object:Gem::Version
185
- version: 0.2.1
185
+ version: '0.6'
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: parser
188
188
  requirement: !ruby/object:Gem::Requirement
@@ -217,20 +217,14 @@ dependencies:
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: 3.6.1
221
- - - "<="
222
- - !ruby/object:Gem::Version
223
- version: 4.0.0.dev.4
220
+ version: 3.10.0
224
221
  type: :runtime
225
222
  prerelease: false
226
223
  version_requirements: !ruby/object:Gem::Requirement
227
224
  requirements:
228
225
  - - ">="
229
226
  - !ruby/object:Gem::Version
230
- version: 3.6.1
231
- - - "<="
232
- - !ruby/object:Gem::Version
233
- version: 4.0.0.dev.4
227
+ version: 3.10.0
234
228
  - !ruby/object:Gem::Dependency
235
229
  name: reverse_markdown
236
230
  requirement: !ruby/object:Gem::Requirement
@@ -259,6 +253,20 @@ dependencies:
259
253
  - - "~>"
260
254
  - !ruby/object:Gem::Version
261
255
  version: '1.76'
256
+ - !ruby/object:Gem::Dependency
257
+ name: sord
258
+ requirement: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: '7.0'
263
+ type: :runtime
264
+ prerelease: false
265
+ version_requirements: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - "~>"
268
+ - !ruby/object:Gem::Version
269
+ version: '7.0'
262
270
  - !ruby/object:Gem::Dependency
263
271
  name: thor
264
272
  requirement: !ruby/object:Gem::Requirement
@@ -308,33 +316,33 @@ dependencies:
308
316
  - !ruby/object:Gem::Version
309
317
  version: 0.9.24
310
318
  - !ruby/object:Gem::Dependency
311
- name: yard-solargraph
319
+ name: yard-activesupport-concern
312
320
  requirement: !ruby/object:Gem::Requirement
313
321
  requirements:
314
322
  - - "~>"
315
323
  - !ruby/object:Gem::Version
316
- version: '0.1'
324
+ version: '0.0'
317
325
  type: :runtime
318
326
  prerelease: false
319
327
  version_requirements: !ruby/object:Gem::Requirement
320
328
  requirements:
321
329
  - - "~>"
322
330
  - !ruby/object:Gem::Version
323
- version: '0.1'
331
+ version: '0.0'
324
332
  - !ruby/object:Gem::Dependency
325
- name: yard-activesupport-concern
333
+ name: yard-solargraph
326
334
  requirement: !ruby/object:Gem::Requirement
327
335
  requirements:
328
336
  - - "~>"
329
337
  - !ruby/object:Gem::Version
330
- version: '0.0'
338
+ version: '0.1'
331
339
  type: :runtime
332
340
  prerelease: false
333
341
  version_requirements: !ruby/object:Gem::Requirement
334
342
  requirements:
335
343
  - - "~>"
336
344
  - !ruby/object:Gem::Version
337
- version: '0.0'
345
+ version: '0.1'
338
346
  - !ruby/object:Gem::Dependency
339
347
  name: pry
340
348
  requirement: !ruby/object:Gem::Requirement
@@ -391,6 +399,20 @@ dependencies:
391
399
  - - "~>"
392
400
  - !ruby/object:Gem::Version
393
401
  version: '3.5'
402
+ - !ruby/object:Gem::Dependency
403
+ name: overcommit
404
+ requirement: !ruby/object:Gem::Requirement
405
+ requirements:
406
+ - - "~>"
407
+ - !ruby/object:Gem::Version
408
+ version: 0.68.0
409
+ type: :development
410
+ prerelease: false
411
+ version_requirements: !ruby/object:Gem::Requirement
412
+ requirements:
413
+ - - "~>"
414
+ - !ruby/object:Gem::Version
415
+ version: 0.68.0
394
416
  - !ruby/object:Gem::Dependency
395
417
  name: rubocop
396
418
  requirement: !ruby/object:Gem::Requirement
@@ -489,20 +511,6 @@ dependencies:
489
511
  - - "~>"
490
512
  - !ruby/object:Gem::Version
491
513
  version: '0.7'
492
- - !ruby/object:Gem::Dependency
493
- name: overcommit
494
- requirement: !ruby/object:Gem::Requirement
495
- requirements:
496
- - - "~>"
497
- - !ruby/object:Gem::Version
498
- version: 0.68.0
499
- type: :development
500
- prerelease: false
501
- version_requirements: !ruby/object:Gem::Requirement
502
- requirements:
503
- - - "~>"
504
- - !ruby/object:Gem::Version
505
- version: 0.68.0
506
514
  - !ruby/object:Gem::Dependency
507
515
  name: webmock
508
516
  requirement: !ruby/object:Gem::Requirement
@@ -538,6 +546,7 @@ executables:
538
546
  extensions: []
539
547
  extra_rdoc_files: []
540
548
  files:
549
+ - ".envrc"
541
550
  - ".gitattributes"
542
551
  - ".github/FUNDING.yml"
543
552
  - ".github/workflows/linting.yml"
@@ -566,6 +575,7 @@ files:
566
575
  - lib/solargraph/api_map/store.rb
567
576
  - lib/solargraph/bench.rb
568
577
  - lib/solargraph/complex_type.rb
578
+ - lib/solargraph/complex_type/conformance.rb
569
579
  - lib/solargraph/complex_type/type_methods.rb
570
580
  - lib/solargraph/complex_type/unique_type.rb
571
581
  - lib/solargraph/convention.rb
@@ -688,12 +698,14 @@ files:
688
698
  - lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb
689
699
  - lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb
690
700
  - lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb
701
+ - lib/solargraph/parser/parser_gem/node_processors/or_node.rb
691
702
  - lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb
692
703
  - lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb
693
704
  - lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb
694
705
  - lib/solargraph/parser/parser_gem/node_processors/send_node.rb
695
706
  - lib/solargraph/parser/parser_gem/node_processors/sym_node.rb
696
707
  - lib/solargraph/parser/parser_gem/node_processors/until_node.rb
708
+ - lib/solargraph/parser/parser_gem/node_processors/when_node.rb
697
709
  - lib/solargraph/parser/parser_gem/node_processors/while_node.rb
698
710
  - lib/solargraph/parser/region.rb
699
711
  - lib/solargraph/parser/snippet.rb
@@ -706,6 +718,7 @@ files:
706
718
  - lib/solargraph/pin/class_variable.rb
707
719
  - lib/solargraph/pin/closure.rb
708
720
  - lib/solargraph/pin/common.rb
721
+ - lib/solargraph/pin/compound_statement.rb
709
722
  - lib/solargraph/pin/constant.rb
710
723
  - lib/solargraph/pin/conversions.rb
711
724
  - lib/solargraph/pin/delegated_method.rb
@@ -728,6 +741,7 @@ files:
728
741
  - lib/solargraph/pin/reference/prepend.rb
729
742
  - lib/solargraph/pin/reference/require.rb
730
743
  - lib/solargraph/pin/reference/superclass.rb
744
+ - lib/solargraph/pin/reference/type_alias.rb
731
745
  - lib/solargraph/pin/search.rb
732
746
  - lib/solargraph/pin/signature.rb
733
747
  - lib/solargraph/pin/singleton.rb
@@ -742,6 +756,7 @@ files:
742
756
  - lib/solargraph/rbs_map/core_fills.rb
743
757
  - lib/solargraph/rbs_map/core_map.rb
744
758
  - lib/solargraph/rbs_map/stdlib_map.rb
759
+ - lib/solargraph/rbs_translator.rb
745
760
  - lib/solargraph/server_methods.rb
746
761
  - lib/solargraph/shell.rb
747
762
  - lib/solargraph/source.rb
@@ -774,8 +789,6 @@ files:
774
789
  - lib/solargraph/source_map/data.rb
775
790
  - lib/solargraph/source_map/mapper.rb
776
791
  - lib/solargraph/type_checker.rb
777
- - lib/solargraph/type_checker/checks.rb
778
- - lib/solargraph/type_checker/param_def.rb
779
792
  - lib/solargraph/type_checker/problem.rb
780
793
  - lib/solargraph/type_checker/rules.rb
781
794
  - lib/solargraph/version.rb
@@ -788,27 +801,36 @@ files:
788
801
  - lib/solargraph/views/search.erb
789
802
  - lib/solargraph/workspace.rb
790
803
  - lib/solargraph/workspace/config.rb
804
+ - lib/solargraph/workspace/gemspecs.rb
791
805
  - lib/solargraph/workspace/require_paths.rb
792
806
  - lib/solargraph/yard_map.rb
793
807
  - lib/solargraph/yard_map/cache.rb
808
+ - lib/solargraph/yard_map/directives.rb
809
+ - lib/solargraph/yard_map/directives/attribute_directive.rb
810
+ - lib/solargraph/yard_map/directives/domain_directive.rb
811
+ - lib/solargraph/yard_map/directives/method_directive.rb
812
+ - lib/solargraph/yard_map/directives/override_directive.rb
813
+ - lib/solargraph/yard_map/directives/parse_directive.rb
814
+ - lib/solargraph/yard_map/directives/visibility_directive.rb
794
815
  - lib/solargraph/yard_map/helpers.rb
816
+ - lib/solargraph/yard_map/macro.rb
795
817
  - lib/solargraph/yard_map/mapper.rb
796
818
  - lib/solargraph/yard_map/mapper/to_constant.rb
797
819
  - lib/solargraph/yard_map/mapper/to_method.rb
798
820
  - lib/solargraph/yard_map/mapper/to_namespace.rb
799
- - lib/solargraph/yard_map/to_method.rb
800
821
  - lib/solargraph/yard_tags.rb
801
822
  - lib/solargraph/yardoc.rb
802
823
  - rbs/fills/bundler/0/bundler.rbs
803
824
  - rbs/fills/open3/0/open3.rbs
804
825
  - rbs/fills/rubygems/0/basic_specification.rbs
826
+ - rbs/fills/rubygems/0/dependency.rbs
805
827
  - rbs/fills/rubygems/0/errors.rbs
806
828
  - rbs/fills/rubygems/0/spec_fetcher.rbs
807
829
  - rbs/fills/rubygems/0/specification.rbs
808
- - rbs/fills/tuple/tuple.rbs
809
830
  - rbs/shims/ast/0/node.rbs
810
831
  - rbs/shims/ast/2.4/.rbs_meta.yaml
811
832
  - rbs/shims/ast/2.4/ast.rbs
833
+ - rbs/shims/diff-lcs/1.5/diff-lcs.rbs
812
834
  - rbs/shims/parser/3.2.0.1/builders/default.rbs
813
835
  - rbs/shims/parser/3.2.0.1/manifest.yaml
814
836
  - rbs/shims/parser/3.2.0.1/parser.rbs
@@ -834,14 +856,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
834
856
  requirements:
835
857
  - - ">="
836
858
  - !ruby/object:Gem::Version
837
- version: '3.0'
859
+ version: '3.1'
838
860
  required_rubygems_version: !ruby/object:Gem::Requirement
839
861
  requirements:
840
862
  - - ">="
841
863
  - !ruby/object:Gem::Version
842
864
  version: '0'
843
865
  requirements: []
844
- rubygems_version: 3.6.7
866
+ rubygems_version: 4.0.6
845
867
  specification_version: 4
846
868
  summary: A Ruby language server
847
869
  test_files: []
@@ -1,124 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class TypeChecker
5
- # Helper methods for performing type checks
6
- #
7
- module Checks
8
- module_function
9
-
10
- # Compare an expected type with an inferred type. Common usage is to
11
- # check if the type declared in a method's @return tag matches the type
12
- # inferred from static analysis of the code.
13
- #
14
- # @param api_map [ApiMap]
15
- # @param expected [ComplexType]
16
- # @param inferred [ComplexType]
17
- # @return [Boolean]
18
- def types_match? api_map, expected, inferred
19
- return true if expected.to_s == inferred.to_s
20
- matches = []
21
- expected.each do |exp|
22
- found = false
23
- inferred.each do |inf|
24
- # if api_map.super_and_sub?(fuzz(inf), fuzz(exp))
25
- if either_way?(api_map, inf, exp)
26
- found = true
27
- matches.push inf
28
- break
29
- end
30
- end
31
- return false unless found
32
- end
33
- inferred.each do |inf|
34
- next if matches.include?(inf)
35
- found = false
36
- expected.each do |exp|
37
- # if api_map.super_and_sub?(fuzz(inf), fuzz(exp))
38
- if either_way?(api_map, inf, exp)
39
- found = true
40
- break
41
- end
42
- end
43
- return false unless found
44
- end
45
- true
46
- end
47
-
48
- # @param api_map [ApiMap]
49
- # @param expected [ComplexType]
50
- # @param inferred [ComplexType]
51
- # @return [Boolean]
52
- def any_types_match? api_map, expected, inferred
53
- expected = expected.downcast_to_literal_if_possible
54
- inferred = inferred.downcast_to_literal_if_possible
55
- return duck_types_match?(api_map, expected, inferred) if expected.duck_type?
56
- # walk through the union expected type and see if any members
57
- # of the union match the inferred type
58
- expected.each do |exp|
59
- next if exp.duck_type?
60
- # @todo: there should be a level of typechecking where all
61
- # unique types in the inferred must match one of the
62
- # expected unique types
63
- inferred.each do |inf|
64
- # return true if exp == inf || api_map.super_and_sub?(fuzz(inf), fuzz(exp))
65
- return true if exp == inf || either_way?(api_map, inf, exp)
66
- end
67
- end
68
- false
69
- end
70
-
71
- # @param api_map [ApiMap]
72
- # @param inferred [ComplexType]
73
- # @param expected [ComplexType]
74
- # @return [Boolean]
75
- def all_types_match? api_map, inferred, expected
76
- expected = expected.downcast_to_literal_if_possible
77
- inferred = inferred.downcast_to_literal_if_possible
78
- return duck_types_match?(api_map, expected, inferred) if expected.duck_type?
79
- inferred.each do |inf|
80
- next if inf.duck_type?
81
- return false unless expected.any? { |exp| exp == inf || either_way?(api_map, inf, exp) }
82
- end
83
- true
84
- end
85
-
86
- # @param api_map [ApiMap]
87
- # @param expected [ComplexType]
88
- # @param inferred [ComplexType]
89
- # @return [Boolean]
90
- def duck_types_match? api_map, expected, inferred
91
- raise ArgumentError, 'Expected type must be duck type' unless expected.duck_type?
92
- expected.each do |exp|
93
- next unless exp.duck_type?
94
- quack = exp.to_s[1..-1]
95
- return false if api_map.get_method_stack(inferred.namespace, quack, scope: inferred.scope).empty?
96
- end
97
- true
98
- end
99
-
100
- # @param type [ComplexType::UniqueType]
101
- # @return [String]
102
- def fuzz type
103
- if type.parameters?
104
- type.name
105
- else
106
- type.tag
107
- end
108
- end
109
-
110
- # @param api_map [ApiMap]
111
- # @param cls1 [ComplexType::UniqueType]
112
- # @param cls2 [ComplexType::UniqueType]
113
- # @return [Boolean]
114
- def either_way?(api_map, cls1, cls2)
115
- # @todo there should be a level of typechecking which uses the
116
- # full tag with parameters to determine compatibility
117
- f1 = cls1.name
118
- f2 = cls2.name
119
- api_map.type_include?(f1, f2) || api_map.super_and_sub?(f1, f2) || api_map.super_and_sub?(f2, f1)
120
- # api_map.type_include?(f1, f2) || api_map.super_and_sub?(f1, f2) || api_map.super_and_sub?(f2, f1)
121
- end
122
- end
123
- end
124
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class TypeChecker
5
- # Data about a method parameter definition. This is the information from
6
- # the args list in the def call, not the `@param` tags.
7
- #
8
- class ParamDef
9
- # @return [String]
10
- attr_reader :name
11
-
12
- # @return [Symbol]
13
- attr_reader :type
14
-
15
- # @param name [String]
16
- # @param type [Symbol] The type of parameter, such as :req, :opt, :rest, etc.
17
- def initialize name, type
18
- @name = name
19
- @type = type
20
- end
21
-
22
- class << self
23
- # Get an array of ParamDefs from a method pin.
24
- #
25
- # @param pin [Solargraph::Pin::Method]
26
- # @return [Array<ParamDef>]
27
- def from pin
28
- result = []
29
- pin.parameters.each do |par|
30
- result.push ParamDef.new(par.name, par.decl)
31
- end
32
- result
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class YardMap
5
- class ToMethod
6
- module InnerMethods
7
- module_function
8
-
9
- # @param code_object [YARD::CodeObjects::Base]
10
- # @param location [Solargraph::Location]
11
- # @param comments [String]
12
- # @return [Array<Solargraph::Pin::Parameter>]
13
- def get_parameters code_object, location, comments
14
- return [] unless code_object.is_a?(YARD::CodeObjects::MethodObject)
15
- # HACK: Skip `nil` and `self` parameters that are sometimes emitted
16
- # for methods defined in C
17
- # See https://github.com/castwide/solargraph/issues/345
18
- # @sg-ignore https://github.com/castwide/solargraph/pull/1114
19
- code_object.parameters.select { |a| a[0] && a[0] != 'self' }.map do |a|
20
- Solargraph::Pin::Parameter.new(
21
- location: location,
22
- closure: self,
23
- comments: comments,
24
- name: arg_name(a),
25
- presence: nil,
26
- decl: arg_type(a),
27
- asgn_code: a[1],
28
- source: :yard_map
29
- )
30
- end
31
- end
32
-
33
- # @param a [Array<String>]
34
- # @return [String]
35
- def arg_name a
36
- a[0].gsub(/[^a-z0-9_]/i, '')
37
- end
38
-
39
- # @param a [Array]
40
- # @return [::Symbol]
41
- def arg_type a
42
- if a[0].start_with?('**')
43
- :kwrestarg
44
- elsif a[0].start_with?('*')
45
- :restarg
46
- elsif a[0].start_with?('&')
47
- :blockarg
48
- elsif a[0].end_with?(':')
49
- a[1] ? :kwoptarg : :kwarg
50
- elsif a[1]
51
- :optarg
52
- else
53
- :arg
54
- end
55
- end
56
- end
57
- private_constant :InnerMethods
58
-
59
- include Helpers
60
-
61
- # @param code_object [YARD::CodeObjects::MethodObject]
62
- # @param name [String, nil]
63
- # @param scope [Symbol, nil]
64
- # @param visibility [Symbol, nil]
65
- # @param closure [Solargraph::Pin::Base, nil]
66
- # @param spec [Solargraph::Pin::Base, nil]
67
- # @return [Solargraph::Pin::Method]
68
- def make code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil
69
- closure ||= Solargraph::Pin::Namespace.new(
70
- name: code_object.namespace.to_s,
71
- gates: [code_object.namespace.to_s]
72
- )
73
- location = object_location(code_object, spec)
74
- comments = code_object.docstring ? code_object.docstring.all.to_s : ''
75
- Pin::Method.new(
76
- location: location,
77
- closure: closure,
78
- name: name || code_object.name.to_s,
79
- comments: comments,
80
- scope: scope || code_object.scope,
81
- visibility: visibility || code_object.visibility,
82
- parameters: InnerMethods.get_parameters(code_object, location, comments),
83
- explicit: code_object.is_explicit?,
84
- source: :yard_map
85
- )
86
- end
87
- end
88
- end
89
- end
@@ -1,149 +0,0 @@
1
- # <-- liberally borrowed from
2
- # https://github.com/ruby/rbs/blob/master/core/array.rbs, which
3
- # was generated from
4
- # https://github.com/ruby/ruby/blob/master/array.c
5
- # -->
6
- module Solargraph
7
- module Fills
8
- class Tuple[unchecked out A,
9
- unchecked out B = A,
10
- unchecked out C = A | B,
11
- unchecked out D = A | B | C,
12
- unchecked out E = A | B | C | D,
13
- unchecked out F = A | B | C | D | E,
14
- unchecked out G = A | B | C | D | E | F,
15
- unchecked out H = A | B | C | D | E | F | G,
16
- unchecked out I = A | B | C | D | E | F | G | H,
17
- unchecked out J = A | B | C | D | E | F | G | H | I] < Array[A | B | C | D | E | F | G | H | I | J]
18
- # <!--
19
- # rdoc-file=array.c
20
- # - self[index] -> object or nil
21
- # -->
22
- # Returns elements from `self`; does not modify `self`.
23
- #
24
- # In brief:
25
- #
26
- # a = [:foo, 'bar', 2]
27
- #
28
- # # Single argument index: returns one element.
29
- # a[0] # => :foo # Zero-based index.
30
- #
31
- # When a single integer argument `index` is given, returns the element at offset
32
- # `index`:
33
- #
34
- # a = [:foo, 'bar', 2]
35
- # a[0] # => :foo
36
- # a[2] # => 2
37
- # a # => [:foo, "bar", 2]
38
- def []: (0 index) -> A
39
- | (1 index) -> B
40
- | (2 index) -> C
41
- | (3 index) -> D
42
- | (4 index) -> E
43
- | (5 index) -> F
44
- | (6 index) -> G
45
- | (7 index) -> H
46
- | (8 index) -> I
47
- | (9 index) -> J
48
- | (int index) -> nil
49
-
50
- # <!--
51
- # rdoc-file=array.c
52
- # - at(index) -> object or nil
53
- # -->
54
- # Returns the element of `self` specified by the given `index` or `nil` if there
55
- # is no such element; `index` must be an [integer-convertible
56
- # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
57
- #
58
- # For non-negative `index`, returns the element of `self` at offset `index`:
59
- #
60
- # a = [:foo, 'bar', 2]
61
- # a.at(0) # => :foo
62
- # a.at(2) # => 2
63
- # a.at(2.0) # => 2
64
- #
65
- # Related: Array#[]; see also [Methods for
66
- # Fetching](rdoc-ref:Array@Methods+for+Fetching).
67
- #
68
- def at: (0 index) -> A
69
- | (1 index) -> B
70
- | (2 index) -> C
71
- | (3 index) -> D
72
- | (4 index) -> E
73
- | (5 index) -> F
74
- | (6 index) -> G
75
- | (7 index) -> H
76
- | (8 index) -> I
77
- | (9 index) -> J
78
- | (int index) -> nil
79
-
80
- # <!--
81
- # rdoc-file=array.c
82
- # - fetch(index) -> element
83
- # - fetch(index, default_value) -> element or default_value
84
- # - fetch(index) {|index| ... } -> element or block_return_value
85
- # -->
86
- # Returns the element of `self` at offset `index` if `index` is in range;
87
- # `index` must be an [integer-convertible
88
- # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
89
- #
90
- # With the single argument `index` and no block, returns the element at offset
91
- # `index`:
92
- #
93
- # a = [:foo, 'bar', 2]
94
- # a.fetch(1) # => "bar"
95
- # a.fetch(1.1) # => "bar"
96
- #
97
- # With arguments `index` and `default_value` (which may be any object) and no
98
- # block, returns `default_value` if `index` is out-of-range:
99
- #
100
- # a = [:foo, 'bar', 2]
101
- # a.fetch(1, nil) # => "bar"
102
- # a.fetch(3, :foo) # => :foo
103
- #
104
- # With argument `index` and a block, returns the element at offset `index` if
105
- # index is in range (and the block is not called); otherwise calls the block
106
- # with index and returns its return value:
107
- #
108
- # a = [:foo, 'bar', 2]
109
- # a.fetch(1) {|index| raise 'Cannot happen' } # => "bar"
110
- # a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
111
- #
112
- # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
113
- #
114
- def fetch: (0 index) -> A
115
- | (1 index) -> B
116
- | (2 index) -> C
117
- | (3 index) -> D
118
- | (4 index) -> E
119
- | (5 index) -> F
120
- | (6 index) -> G
121
- | (7 index) -> H
122
- | (8 index) -> I
123
- | (9 index) -> J
124
- | (int index) -> void
125
- | [T] (0 index, T default) -> (A | T)
126
- | [T] (1 index, T default) -> (B | T)
127
- | [T] (2 index, T default) -> (C | T)
128
- | [T] (3 index, T default) -> (D | T)
129
- | [T] (4 index, T default) -> (E | T)
130
- | [T] (5 index, T default) -> (F | T)
131
- | [T] (6 index, T default) -> (G | T)
132
- | [T] (7 index, T default) -> (H | T)
133
- | [T] (8 index, T default) -> (I | T)
134
- | [T] (9 index, T default) -> (J | T)
135
- | [T] (int index, T default) -> (A | B | C | D | E | F | G | H | I | J | T)
136
- | [T] (0 index) { (int index) -> T } -> (A | T)
137
- | [T] (1 index) { (int index) -> T } -> (B | T)
138
- | [T] (2 index) { (int index) -> T } -> (C | T)
139
- | [T] (3 index) { (int index) -> T } -> (D | T)
140
- | [T] (4 index) { (int index) -> T } -> (E | T)
141
- | [T] (5 index) { (int index) -> T } -> (F | T)
142
- | [T] (6 index) { (int index) -> T } -> (G | T)
143
- | [T] (7 index) { (int index) -> T } -> (H | T)
144
- | [T] (8 index) { (int index) -> T } -> (I | T)
145
- | [T] (9 index) { (int index) -> T } -> (J | T)
146
- | [T] (int index) { (int index) -> T } -> (A | B | C | D | E | F | G | H | I | J | T)
147
- end
148
- end
149
- end