solargraph 0.54.4 → 0.58.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.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -0
  3. data/.github/workflows/linting.yml +127 -0
  4. data/.github/workflows/plugins.yml +185 -6
  5. data/.github/workflows/rspec.yml +55 -5
  6. data/.github/workflows/typecheck.yml +8 -3
  7. data/.gitignore +8 -0
  8. data/.overcommit.yml +72 -0
  9. data/.rspec +1 -0
  10. data/.rubocop.yml +66 -0
  11. data/.rubocop_todo.yml +1279 -0
  12. data/.yardopts +1 -0
  13. data/CHANGELOG.md +143 -0
  14. data/README.md +20 -6
  15. data/Rakefile +125 -13
  16. data/bin/solargraph +3 -0
  17. data/lib/solargraph/api_map/cache.rb +110 -109
  18. data/lib/solargraph/api_map/constants.rb +279 -0
  19. data/lib/solargraph/api_map/index.rb +193 -167
  20. data/lib/solargraph/api_map/source_to_yard.rb +97 -88
  21. data/lib/solargraph/api_map/store.rb +384 -241
  22. data/lib/solargraph/api_map.rb +945 -875
  23. data/lib/solargraph/bench.rb +45 -28
  24. data/lib/solargraph/complex_type/type_methods.rb +228 -217
  25. data/lib/solargraph/complex_type/unique_type.rb +482 -386
  26. data/lib/solargraph/complex_type.rb +444 -394
  27. data/lib/solargraph/convention/active_support_concern.rb +111 -0
  28. data/lib/solargraph/convention/base.rb +20 -3
  29. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -0
  30. data/lib/solargraph/convention/data_definition/data_definition_node.rb +91 -0
  31. data/lib/solargraph/convention/data_definition.rb +105 -0
  32. data/lib/solargraph/convention/gemfile.rb +15 -15
  33. data/lib/solargraph/convention/gemspec.rb +23 -22
  34. data/lib/solargraph/convention/rakefile.rb +17 -17
  35. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +61 -0
  36. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +102 -0
  37. data/lib/solargraph/convention/struct_definition.rb +164 -0
  38. data/lib/solargraph/convention.rb +78 -47
  39. data/lib/solargraph/converters/dd.rb +17 -17
  40. data/lib/solargraph/converters/dl.rb +15 -15
  41. data/lib/solargraph/converters/dt.rb +15 -15
  42. data/lib/solargraph/converters/misc.rb +1 -1
  43. data/lib/solargraph/diagnostics/require_not_found.rb +53 -53
  44. data/lib/solargraph/diagnostics/rubocop.rb +118 -113
  45. data/lib/solargraph/diagnostics/rubocop_helpers.rb +68 -66
  46. data/lib/solargraph/diagnostics/type_check.rb +55 -55
  47. data/lib/solargraph/diagnostics/update_errors.rb +41 -41
  48. data/lib/solargraph/doc_map.rb +439 -188
  49. data/lib/solargraph/environ.rb +9 -2
  50. data/lib/solargraph/equality.rb +34 -33
  51. data/lib/solargraph/gem_pins.rb +98 -72
  52. data/lib/solargraph/language_server/error_codes.rb +20 -20
  53. data/lib/solargraph/language_server/host/diagnoser.rb +89 -89
  54. data/lib/solargraph/language_server/host/dispatch.rb +130 -128
  55. data/lib/solargraph/language_server/host/message_worker.rb +112 -106
  56. data/lib/solargraph/language_server/host/sources.rb +99 -99
  57. data/lib/solargraph/language_server/host.rb +878 -861
  58. data/lib/solargraph/language_server/message/base.rb +97 -96
  59. data/lib/solargraph/language_server/message/client/register_capability.rb +15 -15
  60. data/lib/solargraph/language_server/message/completion_item/resolve.rb +60 -60
  61. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +114 -112
  62. data/lib/solargraph/language_server/message/extended/document.rb +23 -20
  63. data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
  64. data/lib/solargraph/language_server/message/extended/download_core.rb +19 -19
  65. data/lib/solargraph/language_server/message/extended/search.rb +20 -20
  66. data/lib/solargraph/language_server/message/initialize.rb +191 -191
  67. data/lib/solargraph/language_server/message/text_document/completion.rb +56 -56
  68. data/lib/solargraph/language_server/message/text_document/definition.rb +40 -38
  69. data/lib/solargraph/language_server/message/text_document/document_highlight.rb +16 -16
  70. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +26 -26
  71. data/lib/solargraph/language_server/message/text_document/formatting.rb +148 -131
  72. data/lib/solargraph/language_server/message/text_document/hover.rb +58 -58
  73. data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +11 -11
  74. data/lib/solargraph/language_server/message/text_document/references.rb +16 -16
  75. data/lib/solargraph/language_server/message/text_document/rename.rb +19 -19
  76. data/lib/solargraph/language_server/message/text_document/signature_help.rb +24 -24
  77. data/lib/solargraph/language_server/message/text_document/type_definition.rb +25 -24
  78. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +35 -35
  79. data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +40 -40
  80. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +26 -24
  81. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +23 -23
  82. data/lib/solargraph/language_server/message.rb +94 -94
  83. data/lib/solargraph/language_server/progress.rb +8 -0
  84. data/lib/solargraph/language_server/request.rb +27 -24
  85. data/lib/solargraph/language_server/transport/data_reader.rb +74 -74
  86. data/lib/solargraph/language_server/uri_helpers.rb +49 -49
  87. data/lib/solargraph/library.rb +683 -662
  88. data/lib/solargraph/location.rb +82 -58
  89. data/lib/solargraph/logging.rb +37 -27
  90. data/lib/solargraph/page.rb +92 -89
  91. data/lib/solargraph/parser/comment_ripper.rb +69 -56
  92. data/lib/solargraph/parser/flow_sensitive_typing.rb +255 -0
  93. data/lib/solargraph/parser/node_processor/base.rb +92 -87
  94. data/lib/solargraph/parser/node_processor.rb +62 -45
  95. data/lib/solargraph/parser/parser_gem/class_methods.rb +149 -157
  96. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +19 -18
  97. data/lib/solargraph/parser/parser_gem/node_chainer.rb +166 -164
  98. data/lib/solargraph/parser/parser_gem/node_methods.rb +486 -495
  99. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +2 -1
  100. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +22 -0
  101. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +59 -57
  102. data/lib/solargraph/parser/parser_gem/node_processors/begin_node.rb +15 -15
  103. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +46 -43
  104. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -1
  105. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +2 -1
  106. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +53 -50
  107. data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +37 -36
  108. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +2 -1
  109. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +23 -0
  110. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +40 -38
  111. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +29 -28
  112. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +59 -53
  113. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +8 -7
  114. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +98 -0
  115. data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +17 -16
  116. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +38 -36
  117. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +52 -42
  118. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +291 -259
  119. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +3 -1
  120. data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -0
  121. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +29 -0
  122. data/lib/solargraph/parser/parser_gem/node_processors.rb +70 -56
  123. data/lib/solargraph/parser/parser_gem.rb +12 -12
  124. data/lib/solargraph/parser/region.rb +69 -66
  125. data/lib/solargraph/parser/snippet.rb +17 -15
  126. data/lib/solargraph/parser.rb +23 -22
  127. data/lib/solargraph/pin/base.rb +729 -378
  128. data/lib/solargraph/pin/base_variable.rb +126 -118
  129. data/lib/solargraph/pin/block.rb +104 -101
  130. data/lib/solargraph/pin/breakable.rb +9 -0
  131. data/lib/solargraph/pin/callable.rb +231 -147
  132. data/lib/solargraph/pin/closure.rb +72 -57
  133. data/lib/solargraph/pin/common.rb +79 -70
  134. data/lib/solargraph/pin/constant.rb +45 -43
  135. data/lib/solargraph/pin/conversions.rb +123 -123
  136. data/lib/solargraph/pin/delegated_method.rb +120 -101
  137. data/lib/solargraph/pin/documenting.rb +114 -98
  138. data/lib/solargraph/pin/instance_variable.rb +34 -34
  139. data/lib/solargraph/pin/keyword.rb +20 -15
  140. data/lib/solargraph/pin/local_variable.rb +75 -67
  141. data/lib/solargraph/pin/method.rb +672 -527
  142. data/lib/solargraph/pin/method_alias.rb +34 -31
  143. data/lib/solargraph/pin/namespace.rb +115 -107
  144. data/lib/solargraph/pin/parameter.rb +275 -212
  145. data/lib/solargraph/pin/proxy_type.rb +39 -29
  146. data/lib/solargraph/pin/reference/override.rb +47 -29
  147. data/lib/solargraph/pin/reference/require.rb +2 -2
  148. data/lib/solargraph/pin/reference/superclass.rb +15 -10
  149. data/lib/solargraph/pin/reference.rb +39 -22
  150. data/lib/solargraph/pin/search.rb +61 -56
  151. data/lib/solargraph/pin/signature.rb +61 -17
  152. data/lib/solargraph/pin/singleton.rb +1 -1
  153. data/lib/solargraph/pin/symbol.rb +53 -47
  154. data/lib/solargraph/pin/until.rb +18 -0
  155. data/lib/solargraph/pin/while.rb +18 -0
  156. data/lib/solargraph/pin.rb +44 -41
  157. data/lib/solargraph/pin_cache.rb +245 -0
  158. data/lib/solargraph/position.rb +132 -107
  159. data/lib/solargraph/range.rb +112 -98
  160. data/lib/solargraph/rbs_map/conversions.rb +823 -646
  161. data/lib/solargraph/rbs_map/core_fills.rb +84 -50
  162. data/lib/solargraph/rbs_map/core_map.rb +58 -28
  163. data/lib/solargraph/rbs_map/stdlib_map.rb +43 -33
  164. data/lib/solargraph/rbs_map.rb +163 -93
  165. data/lib/solargraph/server_methods.rb +16 -16
  166. data/lib/solargraph/shell.rb +363 -269
  167. data/lib/solargraph/source/chain/array.rb +37 -33
  168. data/lib/solargraph/source/chain/block_symbol.rb +1 -1
  169. data/lib/solargraph/source/chain/block_variable.rb +1 -1
  170. data/lib/solargraph/source/chain/call.rb +337 -303
  171. data/lib/solargraph/source/chain/class_variable.rb +13 -13
  172. data/lib/solargraph/source/chain/constant.rb +26 -89
  173. data/lib/solargraph/source/chain/global_variable.rb +13 -13
  174. data/lib/solargraph/source/chain/hash.rb +34 -33
  175. data/lib/solargraph/source/chain/head.rb +1 -1
  176. data/lib/solargraph/source/chain/if.rb +28 -28
  177. data/lib/solargraph/source/chain/instance_variable.rb +13 -13
  178. data/lib/solargraph/source/chain/link.rb +109 -98
  179. data/lib/solargraph/source/chain/literal.rb +48 -28
  180. data/lib/solargraph/source/chain/or.rb +23 -23
  181. data/lib/solargraph/source/chain/q_call.rb +11 -11
  182. data/lib/solargraph/source/chain/variable.rb +13 -13
  183. data/lib/solargraph/source/chain/z_super.rb +30 -30
  184. data/lib/solargraph/source/chain.rb +291 -252
  185. data/lib/solargraph/source/change.rb +82 -82
  186. data/lib/solargraph/source/cursor.rb +166 -167
  187. data/lib/solargraph/source/encoding_fixes.rb +23 -23
  188. data/lib/solargraph/source/source_chainer.rb +194 -194
  189. data/lib/solargraph/source/updater.rb +55 -55
  190. data/lib/solargraph/source.rb +498 -495
  191. data/lib/solargraph/source_map/clip.rb +226 -232
  192. data/lib/solargraph/source_map/data.rb +34 -30
  193. data/lib/solargraph/source_map/mapper.rb +259 -255
  194. data/lib/solargraph/source_map.rb +212 -217
  195. data/lib/solargraph/type_checker/checks.rb +124 -120
  196. data/lib/solargraph/type_checker/param_def.rb +37 -35
  197. data/lib/solargraph/type_checker/problem.rb +32 -32
  198. data/lib/solargraph/type_checker/rules.rb +84 -62
  199. data/lib/solargraph/type_checker.rb +814 -672
  200. data/lib/solargraph/version.rb +5 -5
  201. data/lib/solargraph/views/_method.erb +10 -10
  202. data/lib/solargraph/views/_namespace.erb +3 -3
  203. data/lib/solargraph/views/document.erb +10 -10
  204. data/lib/solargraph/workspace/config.rb +255 -239
  205. data/lib/solargraph/workspace/require_paths.rb +97 -0
  206. data/lib/solargraph/workspace.rb +220 -239
  207. data/lib/solargraph/yard_map/helpers.rb +44 -16
  208. data/lib/solargraph/yard_map/mapper/to_constant.rb +7 -5
  209. data/lib/solargraph/yard_map/mapper/to_method.rb +130 -94
  210. data/lib/solargraph/yard_map/mapper/to_namespace.rb +31 -28
  211. data/lib/solargraph/yard_map/mapper.rb +79 -78
  212. data/lib/solargraph/yard_map/to_method.rb +89 -86
  213. data/lib/solargraph/yard_tags.rb +20 -20
  214. data/lib/solargraph/yardoc.rb +87 -52
  215. data/lib/solargraph.rb +105 -72
  216. data/rbs/fills/bundler/0/bundler.rbs +4271 -0
  217. data/rbs/fills/open3/0/open3.rbs +172 -0
  218. data/rbs/fills/rubygems/0/basic_specification.rbs +326 -0
  219. data/rbs/fills/rubygems/0/errors.rbs +364 -0
  220. data/rbs/fills/rubygems/0/spec_fetcher.rbs +107 -0
  221. data/rbs/fills/rubygems/0/specification.rbs +1753 -0
  222. data/rbs/fills/tuple/tuple.rbs +149 -0
  223. data/rbs/shims/ast/0/node.rbs +5 -0
  224. data/rbs/shims/ast/2.4/.rbs_meta.yaml +9 -0
  225. data/rbs/shims/ast/2.4/ast.rbs +73 -0
  226. data/rbs/shims/parser/3.2.0.1/builders/default.rbs +195 -0
  227. data/rbs/shims/parser/3.2.0.1/manifest.yaml +7 -0
  228. data/rbs/shims/parser/3.2.0.1/parser.rbs +201 -0
  229. data/rbs/shims/parser/3.2.0.1/polyfill.rbs +4 -0
  230. data/rbs/shims/thor/1.2.0.1/.rbs_meta.yaml +9 -0
  231. data/rbs/shims/thor/1.2.0.1/manifest.yaml +7 -0
  232. data/rbs/shims/thor/1.2.0.1/thor.rbs +17 -0
  233. data/rbs_collection.yaml +19 -0
  234. data/solargraph.gemspec +27 -5
  235. metadata +215 -18
  236. data/lib/.rubocop.yml +0 -22
  237. data/lib/solargraph/cache.rb +0 -77
  238. data/lib/solargraph/parser/node_methods.rb +0 -83
data/.yardopts CHANGED
@@ -1,2 +1,3 @@
1
1
  lib/**/*.rb
2
2
  --plugin yard-solargraph
3
+ --plugin activesupport-concern
data/CHANGELOG.md CHANGED
@@ -1,3 +1,146 @@
1
+ ## 0.58.3 - March 9, 2026
2
+ - Ignore workspace dependencies in cache processes (#1174)
3
+
4
+ ## 0.58.2 - January 19, 2026
5
+ - Avoid rbs pollution (#1146)
6
+ - Fix 'solargraph pin --references ClassName' private method call (#1150)
7
+ - Improve memory efficiency of Position class (#1054)
8
+ - Raise InvalidOffsetError for offsets > text (#1155)
9
+
10
+ ## 0.58.1 - January 2, 2026
11
+ - Normalize line endings to LF (#1142)
12
+
13
+ ## 0.58.0 - January 1, 2026
14
+ - Faster constant resolution (#1083)
15
+ - [regression] Handle RBS static method aliases (#1094)
16
+ - More type fills and shims (#1005)
17
+ - Fix resolution in blocks in type checker (#890)
18
+ - Annotation fixes for strong typechecking (#1057)
19
+ - Remove dead code (#1077)
20
+ - Fix flakey spec (#1080)
21
+ - Fix bad sexpr generation in op_asgn (#1089)
22
+ - Opt-in for MFA requirement (#730)
23
+ - [regression] Fix resolution issues with namespaces from YARD (#1097)
24
+ - Improve a pin combination case around selfy types (#1024)
25
+ - Rescue reference errors in hosts (#1105)
26
+ - Relax bundler runtime dependency version constraint to support newer versions (#1125)
27
+ - Remove stale Pathname test (#1135)
28
+ - Enable strong type checking in CI (#928)
29
+ - Stale sg-ignore
30
+ - Use rbs 3.9.5 in tests (#1136)
31
+ - Drop broken 'namespaces' method (#1065)
32
+ - Add ActiveRecord example from RBS (#1074)
33
+ - Keep workspace directories as absolute paths (#1076)
34
+ - Handle bad gem_dir from gemspec object (#1079)
35
+ - Test for absolute require paths (#1137)
36
+ - [regression] Fix resolution of ambiguous argument types (#1098)
37
+ - Remove sg-ignore for String#=~ (#1138)
38
+ - Allow levels to be changed for typechecking rules in .solargraph.yml (#1126)
39
+
40
+ ## 0.57.0 - September 16, 2025
41
+ - Support ActiveSupport::Concern pattern for class methods (#948)
42
+ - More CI checks (#996)
43
+ - Linting / type annotation fixes (#999)
44
+ - Avoid overlapping chdir calls in multiple threads (#1007)
45
+ - Fix kwarg generation in ApiMap::SourceToYard (#1003)
46
+ - Enable Steep typechecking of Solargraph code (#1004)
47
+ - Fix convention requires (#1008)
48
+ - Plugin Util: Add Combination Priority (#1010)
49
+ - [regression] Fix crash while typechecking files with Struct use (#1031)
50
+ - Remove yard reference from gemfile (#1033)
51
+ - Allow newer RBS gem versions, exclude incompatible ones (#995)
52
+ - Look for external requires before cataloging bench (#1021)
53
+ - Remove Library#folding_ranges (#904)
54
+ - Complain in strong type-checking if an @sg-ignore line is not needed (#1011)
55
+ - Document a log level env variable (#894)
56
+ - Fix hole in type checking evaluation (#1009)
57
+ - Improve typechecking error message (#1014)
58
+ - Internal strict type-checking fixes (#1013)
59
+ - Reproduce and fix a ||= (or-asgn) evaluation issue (#1017)
60
+ - Define closure for Pin::Symbol, for completeness (#1027)
61
+ - Fix 'all!' config to reporters (#1018)
62
+ - Fix DocMap.all_rbs_collection_gems_in_memory return type (#1037)
63
+ - Fix RuboCop linting errors in regular expressions (#1038)
64
+ - Resolve class aliases via Constant pins (#1029)
65
+ - Speed-up LSP completion response times (#1035)
66
+ - Revert "Resolve class aliases via Constant pins (#1029)" (#1041)
67
+ - Avoid stack errors when resolving method aliases (#1040)
68
+ - [regression] Refine order of object convention method pins (#1036)
69
+ - Fix crash while generating activesupport pins (#1043)
70
+ - Type annotation improvements (#1016)
71
+ - Resolve class aliases via Constant pins (#1048)
72
+ - Understand "Parser::AST::Node < AST::Node" in RBS (#1060)
73
+ - Factor out require_paths logic to its own class (#1062)
74
+ - Fix type errors found in strong typechecking (#1045)
75
+ - Run plugin specs separately for perf insights (#1046)
76
+ - Run specs from solargraph-rails configured against current code in CI (#892)
77
+ - Fix Convention/Plugin pins not being updated on file change (#1028)
78
+ - Fix solargraph-rails check (#1073)
79
+ - Flow sensitive typing handles x.is_a? without an argument (#1070)
80
+ - Refactor reference pin handling (#1058)
81
+
82
+ ## 0.56.2 - July 29, 2025
83
+ - Add support for Ruby Data.define (#970)
84
+ - Ensure that pin locations are always populated (#965)
85
+ - Improve struct support (#992)
86
+ - Include Rakefile, Gemfile, and gemspec files in config by default (#984)
87
+ - Use Open3 to cache gemspecs (#1000)
88
+ - Eager load node processors (#1002)
89
+
90
+ ## 0.56.1 - July 13, 2025
91
+ - Library avoids blocking on pending yardoc caches (#990)
92
+ - DocMap checks for default Gemfile (#989)
93
+ - [Bug fix] Fixed an error in rbs/fills/tuple.rbs (#993)
94
+
95
+ ## 0.56.0 - July 1, 2025
96
+ - [regression] Gem caching perf and logging fixes #983
97
+
98
+ ## 0.55.5 - July 1, 2025
99
+ - Flatten results of DocMap external bundle query (#981)
100
+ - [breaking] Reimplement global conventions (#877)
101
+ - GemPins pin merging improvements (#946)
102
+ - Support class-scoped aliases and attributes from RBS (#952)
103
+ - Restructure ComplexType specs towards YARD doc compliance (#969)
104
+ - Use Prism (#974)
105
+ - Document pages (#977)
106
+ - Enable disabled-but-working specs (#978)
107
+ - Map RBS 'untyped' type (RBS::Types::Bases::Any) to 'undefined' (#979)
108
+ - Re-enable support for .gem_rbs_collection directories (#942)
109
+ - [breaking] Comply with YARD documentation on Hash tag format (#968)
110
+ - Ignore directory paths in Workspace#would_require? (#988)
111
+
112
+ ## 0.55.4 - June 27, 2025
113
+ - Flatten results of DocMap external bundle query (#981)
114
+
115
+ ## 0.55.3 - June 25, 2025
116
+ - Nil guards in flow-sensitive typing (patch release) (#980)
117
+
118
+ ## 0.55.2 - June 21, 2025
119
+ - Require external bundle (#972)
120
+
121
+ ## 0.55.1 - June 8, 2025
122
+ - Fix inline Struct definition (#962)
123
+ - Ensure DocMap requires bundler when loading gemspecs (#963)
124
+ - DelegatedMethod improvements (#953)
125
+
126
+ ## 0.55.0 - June 3, 2025
127
+ - Flow-sensitive typing - automatically downcast from is_a? calls (#856)
128
+ - Tuple enabler: infer literal types and use them for signature selection (#836)
129
+ - Signature selection improvements (#907)
130
+ - Add support for Ruby Structs (#939)
131
+ - [regression] Fix interface change breaking solargraph-rails (#940)
132
+ - [regression] Add back bundler/require support for solargraph-rails (#941)
133
+ - Add specs for initialize capabilities (#955)
134
+ - Create MethodAlias pins from YARD (#945)
135
+ - MessageWorker prioritizes synchronization (#956)
136
+ - initialize/new method pin cleanups (#949)
137
+ - Clip rebinds blocks when cursor is not part of receiver (#958)
138
+
139
+ ## 0.54.5 - May 17, 2025
140
+ - Repair unknown encoding errors (#936, #935)
141
+ - Index arbitrary pinsets (#937)
142
+ - Separate YARD cache from doc map cache (#938)
143
+
1
144
  ## 0.54.4 - May 14, 2025
2
145
  - Delete files from Library hash (#932)
3
146
  - Clip#define returns variable pins (#934, #933)
data/README.md CHANGED
@@ -53,7 +53,7 @@ Solargraph's behavior can be controlled via optional [configuration](https://sol
53
53
 
54
54
  ### Plugins
55
55
 
56
- Solargraph supports [plugins](https://solargraph.org/guides/plugins) that implements their own Solargraph features, such as diagnostics reporters and conventions to provide LSP features and type-checking, e.g. for frameworks which use metaprogramming and/or DSLs.
56
+ Solargraph supports [plugins](https://solargraph.org/guides/plugins) that implement their own Solargraph features, such as diagnostics reporters and conventions to provide LSP features and type-checking, e.g. for frameworks which use metaprogramming and/or DSLs.
57
57
 
58
58
  For better Rails support, please consider using [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails/)
59
59
 
@@ -63,15 +63,25 @@ The RSpec framework is supported via [solargraph-rspec](https://github.com/lekem
63
63
 
64
64
  **Note: Before version 0.53.0, it was recommended to run `yard gems` periodically or automate it with `yard config` to ensure that Solargraph had access to gem documentation. These steps are no longer necessary. Solargraph maintains its own gem documentation cache independent of the yardocs in your gem installations.**
65
65
 
66
- Solargraph automatically generates code maps from installed gems. You can also manage your cached gem documentation with the `solargraph gems` command.
66
+ When editing code, a `require` call that references a gem will pull the documentation into the code maps and include the gem's API in code completion and intellisense. Solargraph automatically generates code maps from installed gems, based on the YARD or RBS type information inside the gem. You can also eagerly cache gem documentation with the `solargraph gems` command.
67
67
 
68
- When editing code, a `require` call that references a gem will pull the documentation into the code maps and include the gem's API in code completion and intellisense.
68
+ If your project automatically requires bundled gem with the `Bundler.require` statement, Solargraph will add all of the Gemfile's default dependencies to the map.
69
69
 
70
- If your project automatically requires bundled gems (e.g., `require 'bundler/require'`), Solargraph will add all of the Gemfile's default dependencies to the map.
70
+ To ensure you have types for gems which contain neither RBS nor YARD
71
+ information, use
72
+ [gem\_rbs\_collection](https://github.com/ruby/gem_rbs_collection) to
73
+ install a community-supported set of RBS types for various gems:
74
+
75
+ ```sh
76
+ bundle exec rbs collection init
77
+ bundle exec rbs collection install
78
+ ```
79
+
80
+ Once installed, you can also insert your own local overrides and definitions in RBS in a directory configured in the `rbs_collection.yaml` that the above commands create.
71
81
 
72
82
  ### Type Checking
73
83
 
74
- As of version 0.33.0, Solargraph includes a [type checker](https://github.com/castwide/solargraph/issues/192) that uses a combination of YARD tags and code analysis to report missing type definitions. In strict mode, it performs type inference to determine whether the tags match the types it detects from code.
84
+ As of version 0.33.0, Solargraph includes a [type checker](https://github.com/castwide/solargraph/issues/192) that uses a combination of YARD tags and code analysis to report missing type definitions. In strict mode, it performs type inference to determine whether the tags match the types it detects from code. In strong mode it will ask you to clarify your intentions by adding annotations for better validation.
75
85
 
76
86
  ### The Documentation Cache
77
87
 
@@ -91,7 +101,7 @@ Run `bundle install` and optionally use `bundle exec solargraph gems` to generat
91
101
 
92
102
  In order to make sure you're using the correct dependencies, you can start the language server with Bundler. In VS Code, there's a `solargraph.useBundler` option. Other clients will vary, but the command you probably want to run is `bundle exec solargraph socket` or `bundle exec solargraph stdio`.
93
103
 
94
- ### Rubocop Version
104
+ ### RuboCop Version
95
105
 
96
106
  If you have multiple versions of [`rubocop`](https://rubygems.org/gems/rubocop) installed and you would like to choose a version other than the latest to use, this specific version can be configured.
97
107
 
@@ -122,6 +132,10 @@ See [https://solargraph.org/guides](https://solargraph.org/guides) for more tips
122
132
 
123
133
  ### Development
124
134
 
135
+ To see more logging when typechecking or running specs, set the
136
+ `SOLARGRAPH_LOG` environment variable to `debug` or `info`. `warn` is
137
+ the default value.
138
+
125
139
  Code contributions are always appreciated. Feel free to fork the repo and submit pull requests. Check for open issues that could use help. Start new issues to discuss changes that have a major impact on the code or require large time commitments.
126
140
 
127
141
  ### Sponsorship and Donation
data/Rakefile CHANGED
@@ -1,12 +1,7 @@
1
1
  require 'rake'
2
- require 'rspec/core/rake_task'
3
2
  require 'bundler/gem_tasks'
4
-
5
- begin
6
- require 'rspec/core/rake_task'
7
- RSpec::Core::RakeTask.new(:spec)
8
- rescue LoadError
9
- end
3
+ require 'fileutils'
4
+ require 'open3'
10
5
 
11
6
  desc "Open a Pry session preloaded with this library"
12
7
  task :console do
@@ -14,12 +9,129 @@ task :console do
14
9
  end
15
10
 
16
11
  desc "Run the type checker"
17
- task :typecheck do
18
- sh "bundle exec solargraph typecheck --level typed"
12
+ task typecheck: [:typecheck_strong]
13
+
14
+ desc "Run the type checker at typed level - return code issues provable without annotations being correct"
15
+ task :typecheck_typed do
16
+ sh "SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level typed"
17
+ end
18
+
19
+ desc "Run the type checker at strict level - report issues using type annotations"
20
+ task :typecheck_strict do
21
+ sh "SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strict"
22
+ end
23
+
24
+ desc "Run the type checker at strong level - enforce that type annotations exist"
25
+ task :typecheck_strong do
26
+ sh "SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong"
27
+ end
28
+
29
+ desc "Run the type checker at alpha level - run high-false-alarm checks"
30
+ task :typecheck_alpha do
31
+ sh "SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level alpha"
32
+ end
33
+
34
+ desc "Run RSpec tests, starting with the ones that failed last time"
35
+ task spec: %i[spec_failed undercover_no_fail full_spec] do
36
+ undercover
37
+ end
38
+
39
+ desc "Run all RSpec tests"
40
+ task :full_spec do
41
+ warn 'starting spec'
42
+ sh 'TEST_COVERAGE_COMMAND_NAME=full-new bundle exec rspec' # --profile'
43
+ warn 'ending spec'
44
+ # move coverage/full-new to coverage/full on success so that we
45
+ # always have the last successful run's 'coverage info
46
+ FileUtils.rm_rf('coverage/full')
47
+ FileUtils.mv('coverage/full-new', 'coverage/full')
48
+ end
49
+
50
+ # @sg-ignore #undercover return type could not be inferred
51
+ # @return [Process::Status]
52
+ def undercover
53
+ simplecov_collate
54
+ cmd = 'bundle exec undercover ' \
55
+ '--simplecov coverage/combined/coverage.json ' \
56
+ '--exclude-files "Rakefile,spec/*,spec/**/*,lib/solargraph/version.rb" ' \
57
+ '--compare origin/master'
58
+ output, status = Bundler.with_unbundled_env do
59
+ Open3.capture2e(cmd)
60
+ end
61
+ puts output
62
+ $stdout.flush
63
+ status
64
+ rescue StandardError => e
65
+ warn "hit error: #{e.message}"
66
+ warn "Backtrace:\n#{e.backtrace.join("\n")}"
67
+ warn "output: #{output}"
68
+ puts "Flushing"
69
+ $stdout.flush
70
+ raise
71
+ end
72
+
73
+ desc "Check PR coverage"
74
+ task :undercover do
75
+ raise "Undercover failed" unless undercover.success?
76
+ end
77
+
78
+ desc "Branch-focused fast-feedback quality/spec/coverage checks"
79
+ task test: %i[overcommit spec typecheck] do
80
+ # do these in order
81
+ Rake::Task['typecheck_strict'].invoke
82
+ Rake::Task['typecheck_strong'].invoke
83
+ Rake::Task['typecheck_alpha'].invoke
84
+ end
85
+
86
+ desc "Re-run failed specs. Add --fail-fast in your .rspec-local file if desired."
87
+ task :spec_failed do
88
+ # allow user to check out any persistent failures while looking for
89
+ # more in the whole test suite
90
+ sh 'TEST_COVERAGE_COMMAND_NAME=next-failure bundle exec rspec --only-failures || true'
91
+ end
92
+
93
+ desc "Run undercover and show output without failing the task if it fails"
94
+ task :undercover_no_fail do
95
+ undercover
96
+ rescue StandardError
97
+ puts "Undercover failed, but continuing with other tasks."
98
+ end
99
+
100
+ # @return [void]
101
+ def simplecov_collate
102
+ require 'simplecov'
103
+ require 'simplecov-lcov'
104
+ require 'undercover/simplecov_formatter'
105
+
106
+ SimpleCov.collate(Dir["coverage/{next-failure,full,ad-hoc}/.resultset.json"]) do
107
+ cname = 'combined'
108
+ command_name cname
109
+ new_dir = File.join('coverage', cname)
110
+ coverage_dir new_dir
111
+
112
+ formatter \
113
+ SimpleCov::Formatter::MultiFormatter
114
+ .new([
115
+ SimpleCov::Formatter::HTMLFormatter,
116
+ SimpleCov::Formatter::Undercover,
117
+ SimpleCov::Formatter::LcovFormatter
118
+ ])
119
+ SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
120
+ end
121
+ puts "Simplecov collated results into coverage/combined/.resultset.json"
122
+ rescue StandardError => e
123
+ puts "Simplecov collate failed: #{e.message}"
124
+ ensure
125
+ $stdout.flush
126
+ end
127
+
128
+ desc 'Add incremental coverage for rapid iteration with undercover'
129
+ task :simplecov_collate do
130
+ simplecov_collate
19
131
  end
20
132
 
21
- desc "Run all tests"
22
- task :test do
23
- Rake::Task["typecheck"].invoke
24
- Rake::Task["spec"].invoke
133
+ desc "Show quality checks on this development branch so far, including any staged files"
134
+ task :overcommit do
135
+ # OVERCOMMIT_DEBUG=1 will show more detail
136
+ sh 'SOLARGRAPH_ASSERTS=on bundle exec overcommit --run --diff origin/master'
25
137
  end
data/bin/solargraph CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # turn off warning diagnostics from Ruby
4
+ $VERBOSE=nil
5
+
3
6
  require 'solargraph'
4
7
 
5
8
  Solargraph::Shell.start(ARGV)
@@ -1,109 +1,110 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class ApiMap
5
- class Cache
6
- def initialize
7
- # @type [Hash{Array => Array<Pin::Method>}]
8
- @methods = {}
9
- # @type [Hash{(String, Array<String>) => Array<Pin::Base>}]
10
- @constants = {}
11
- # @type [Hash{String => String}]
12
- @qualified_namespaces = {}
13
- # @type [Hash{String => Pin::Method}]
14
- @receiver_definitions = {}
15
- # @type [Hash{String => SourceMap::Clip}]
16
- @clips = {}
17
- end
18
-
19
- def to_s
20
- self.class.to_s
21
- end
22
-
23
- # avoid enormous dump
24
- def inspect
25
- to_s
26
- end
27
-
28
- # @param fqns [String]
29
- # @param scope [Symbol]
30
- # @param visibility [Array<Symbol>]
31
- # @param deep [Boolean]
32
- # @return [Array<Pin::Method>]
33
- def get_methods fqns, scope, visibility, deep
34
- @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"]
35
- end
36
-
37
- # @param fqns [String]
38
- # @param scope [Symbol]
39
- # @param visibility [Array<Symbol>]
40
- # @param deep [Boolean]
41
- # @param value [Array<Pin::Method>]
42
- # @return [void]
43
- def set_methods fqns, scope, visibility, deep, value
44
- @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] = value
45
- end
46
-
47
- # @param namespace [String]
48
- # @param contexts [Array<String>]
49
- # @return [Array<Pin::Base>]
50
- def get_constants namespace, contexts
51
- @constants["#{namespace}|#{contexts}"]
52
- end
53
-
54
- # @param namespace [String]
55
- # @param contexts [Array<String>]
56
- # @param value [Array<Pin::Base>]
57
- # @return [void]
58
- def set_constants namespace, contexts, value
59
- @constants["#{namespace}|#{contexts}"] = value
60
- end
61
-
62
- # @param name [String]
63
- # @param context [String]
64
- # @return [String]
65
- def get_qualified_namespace name, context
66
- @qualified_namespaces["#{name}|#{context}"]
67
- end
68
-
69
- # @param name [String]
70
- # @param context [String]
71
- # @param value [String]
72
- # @return [void]
73
- def set_qualified_namespace name, context, value
74
- @qualified_namespaces["#{name}|#{context}"] = value
75
- end
76
-
77
- # @param path [String]
78
- # @return [Pin::Method]
79
- def get_receiver_definition path
80
- @receiver_definitions[path]
81
- end
82
-
83
- # @param path [String]
84
- # @param pin [Pin::Method]
85
- # @return [void]
86
- def set_receiver_definition path, pin
87
- @receiver_definitions[path] = pin
88
- end
89
-
90
- # @return [void]
91
- def clear
92
- return if empty?
93
-
94
- all_caches.each(&:clear)
95
- end
96
-
97
- # @return [Boolean]
98
- def empty?
99
- all_caches.all?(&:empty?)
100
- end
101
-
102
- private
103
-
104
- def all_caches
105
- [@methods, @constants, @qualified_namespaces, @receiver_definitions, @clips]
106
- end
107
- end
108
- end
109
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class ApiMap
5
+ class Cache
6
+ def initialize
7
+ # @type [Hash{String => Array<Pin::Method>}]
8
+ @methods = {}
9
+ # @type [Hash{String, Array<String> => Array<Pin::Base>}]
10
+ @constants = {}
11
+ # @type [Hash{String => String}]
12
+ @qualified_namespaces = {}
13
+ # @type [Hash{String => Pin::Method}]
14
+ @receiver_definitions = {}
15
+ # @type [Hash{String => SourceMap::Clip}]
16
+ @clips = {}
17
+ end
18
+
19
+ def to_s
20
+ self.class.to_s
21
+ end
22
+
23
+ # avoid enormous dump
24
+ def inspect
25
+ to_s
26
+ end
27
+
28
+ # @param fqns [String]
29
+ # @param scope [Symbol]
30
+ # @param visibility [Array<Symbol>]
31
+ # @param deep [Boolean]
32
+ # @return [Array<Pin::Method>]
33
+ def get_methods fqns, scope, visibility, deep
34
+ @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"]
35
+ end
36
+
37
+ # @param fqns [String]
38
+ # @param scope [Symbol]
39
+ # @param visibility [Array<Symbol>]
40
+ # @param deep [Boolean]
41
+ # @param value [Array<Pin::Method>]
42
+ # @return [void]
43
+ def set_methods fqns, scope, visibility, deep, value
44
+ @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] = value
45
+ end
46
+
47
+ # @param namespace [String]
48
+ # @param contexts [Array<String>]
49
+ # @return [Array<Pin::Base>]
50
+ def get_constants namespace, contexts
51
+ @constants["#{namespace}|#{contexts}"]
52
+ end
53
+
54
+ # @param namespace [String]
55
+ # @param contexts [Array<String>]
56
+ # @param value [Array<Pin::Base>]
57
+ # @return [void]
58
+ def set_constants namespace, contexts, value
59
+ @constants["#{namespace}|#{contexts}"] = value
60
+ end
61
+
62
+ # @param name [String]
63
+ # @param context [String]
64
+ # @return [String]
65
+ def get_qualified_namespace name, context
66
+ @qualified_namespaces["#{name}|#{context}"]
67
+ end
68
+
69
+ # @param name [String]
70
+ # @param context [String]
71
+ # @param value [String]
72
+ # @return [void]
73
+ def set_qualified_namespace name, context, value
74
+ @qualified_namespaces["#{name}|#{context}"] = value
75
+ end
76
+
77
+ # @param path [String]
78
+ # @return [Pin::Method]
79
+ def get_receiver_definition path
80
+ @receiver_definitions[path]
81
+ end
82
+
83
+ # @param path [String]
84
+ # @param pin [Pin::Method]
85
+ # @return [void]
86
+ def set_receiver_definition path, pin
87
+ @receiver_definitions[path] = pin
88
+ end
89
+
90
+ # @return [void]
91
+ def clear
92
+ return if empty?
93
+
94
+ all_caches.each(&:clear)
95
+ end
96
+
97
+ # @return [Boolean]
98
+ def empty?
99
+ all_caches.all?(&:empty?)
100
+ end
101
+
102
+ private
103
+
104
+ # @return [Array<Object>]
105
+ def all_caches
106
+ [@methods, @constants, @qualified_namespaces, @receiver_definitions, @clips]
107
+ end
108
+ end
109
+ end
110
+ end