solargraph 0.51.2 → 0.54.2

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 (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/plugins.yml +40 -0
  3. data/.github/workflows/rspec.yml +1 -3
  4. data/.github/workflows/typecheck.yml +34 -0
  5. data/.yardopts +2 -2
  6. data/CHANGELOG.md +127 -5
  7. data/README.md +13 -16
  8. data/SPONSORS.md +1 -7
  9. data/lib/solargraph/api_map/cache.rb +50 -20
  10. data/lib/solargraph/api_map/source_to_yard.rb +17 -10
  11. data/lib/solargraph/api_map/store.rb +60 -15
  12. data/lib/solargraph/api_map.rb +282 -123
  13. data/lib/solargraph/bench.rb +3 -2
  14. data/lib/solargraph/cache.rb +29 -5
  15. data/lib/solargraph/complex_type/type_methods.rb +122 -39
  16. data/lib/solargraph/complex_type/unique_type.rb +310 -76
  17. data/lib/solargraph/complex_type.rb +166 -44
  18. data/lib/solargraph/convention.rb +0 -1
  19. data/lib/solargraph/converters/dd.rb +5 -0
  20. data/lib/solargraph/converters/dl.rb +3 -0
  21. data/lib/solargraph/converters/dt.rb +3 -0
  22. data/lib/solargraph/diagnostics/rubocop.rb +8 -7
  23. data/lib/solargraph/diagnostics/rubocop_helpers.rb +1 -0
  24. data/lib/solargraph/diagnostics/type_check.rb +1 -0
  25. data/lib/solargraph/diagnostics.rb +2 -2
  26. data/lib/solargraph/doc_map.rb +187 -0
  27. data/lib/solargraph/gem_pins.rb +72 -0
  28. data/lib/solargraph/language_server/host/diagnoser.rb +2 -2
  29. data/lib/solargraph/language_server/host/dispatch.rb +22 -5
  30. data/lib/solargraph/language_server/host/message_worker.rb +49 -5
  31. data/lib/solargraph/language_server/host/sources.rb +8 -65
  32. data/lib/solargraph/language_server/host.rb +65 -84
  33. data/lib/solargraph/language_server/message/base.rb +19 -12
  34. data/lib/solargraph/language_server/message/completion_item/resolve.rb +3 -1
  35. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +13 -1
  36. data/lib/solargraph/language_server/message/initialize.rb +19 -2
  37. data/lib/solargraph/language_server/message/text_document/completion.rb +0 -3
  38. data/lib/solargraph/language_server/message/text_document/definition.rb +3 -3
  39. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +3 -3
  40. data/lib/solargraph/language_server/message/text_document/formatting.rb +1 -0
  41. data/lib/solargraph/language_server/message/text_document/hover.rb +3 -1
  42. data/lib/solargraph/language_server/message/text_document/type_definition.rb +3 -3
  43. data/lib/solargraph/language_server/message/text_document.rb +0 -1
  44. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +5 -0
  45. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +2 -2
  46. data/lib/solargraph/language_server/progress.rb +135 -0
  47. data/lib/solargraph/language_server/transport/adapter.rb +16 -1
  48. data/lib/solargraph/language_server/transport/data_reader.rb +2 -0
  49. data/lib/solargraph/language_server.rb +1 -0
  50. data/lib/solargraph/library.rb +207 -111
  51. data/lib/solargraph/location.rb +15 -1
  52. data/lib/solargraph/page.rb +6 -0
  53. data/lib/solargraph/parser/comment_ripper.rb +4 -0
  54. data/lib/solargraph/parser/node_methods.rb +47 -7
  55. data/lib/solargraph/parser/node_processor/base.rb +11 -1
  56. data/lib/solargraph/parser/node_processor.rb +1 -0
  57. data/lib/solargraph/parser/{legacy → parser_gem}/class_methods.rb +31 -9
  58. data/lib/solargraph/parser/{legacy → parser_gem}/flawed_builder.rb +3 -1
  59. data/lib/solargraph/parser/{legacy → parser_gem}/node_chainer.rb +62 -43
  60. data/lib/solargraph/parser/parser_gem/node_methods.rb +495 -0
  61. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/alias_node.rb +1 -1
  62. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +57 -0
  63. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/begin_node.rb +1 -1
  64. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/block_node.rb +3 -2
  65. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/casgn_node.rb +2 -2
  66. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/cvasgn_node.rb +1 -1
  67. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/def_node.rb +7 -20
  68. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/defs_node.rb +2 -2
  69. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/gvasgn_node.rb +1 -1
  70. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/ivasgn_node.rb +2 -2
  71. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/lvasgn_node.rb +4 -4
  72. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +53 -0
  73. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/namespace_node.rb +2 -2
  74. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/orasgn_node.rb +1 -1
  75. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/resbody_node.rb +3 -3
  76. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/sclass_node.rb +1 -1
  77. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/send_node.rb +8 -6
  78. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/sym_node.rb +1 -1
  79. data/lib/solargraph/parser/parser_gem/node_processors.rb +56 -0
  80. data/lib/solargraph/parser/parser_gem.rb +12 -0
  81. data/lib/solargraph/parser/region.rb +1 -1
  82. data/lib/solargraph/parser/snippet.rb +2 -0
  83. data/lib/solargraph/parser.rb +8 -12
  84. data/lib/solargraph/pin/base.rb +78 -10
  85. data/lib/solargraph/pin/base_variable.rb +40 -7
  86. data/lib/solargraph/pin/block.rb +69 -46
  87. data/lib/solargraph/pin/callable.rb +147 -0
  88. data/lib/solargraph/pin/closure.rb +23 -3
  89. data/lib/solargraph/pin/common.rb +6 -6
  90. data/lib/solargraph/pin/conversions.rb +36 -5
  91. data/lib/solargraph/pin/delegated_method.rb +6 -2
  92. data/lib/solargraph/pin/documenting.rb +25 -32
  93. data/lib/solargraph/pin/instance_variable.rb +6 -2
  94. data/lib/solargraph/pin/local_variable.rb +13 -1
  95. data/lib/solargraph/pin/method.rb +205 -32
  96. data/lib/solargraph/pin/namespace.rb +20 -7
  97. data/lib/solargraph/pin/parameter.rb +41 -36
  98. data/lib/solargraph/pin/proxy_type.rb +1 -1
  99. data/lib/solargraph/pin/reference/override.rb +2 -2
  100. data/lib/solargraph/pin/reference.rb +8 -0
  101. data/lib/solargraph/pin/search.rb +3 -3
  102. data/lib/solargraph/pin/signature.rb +8 -14
  103. data/lib/solargraph/pin.rb +4 -2
  104. data/lib/solargraph/range.rb +4 -6
  105. data/lib/solargraph/rbs_map/conversions.rb +326 -76
  106. data/lib/solargraph/rbs_map/core_fills.rb +16 -33
  107. data/lib/solargraph/rbs_map/core_map.rb +3 -13
  108. data/lib/solargraph/rbs_map/stdlib_map.rb +2 -8
  109. data/lib/solargraph/rbs_map.rb +32 -13
  110. data/lib/solargraph/shell.rb +95 -72
  111. data/lib/solargraph/source/chain/array.rb +33 -0
  112. data/lib/solargraph/source/chain/block_symbol.rb +13 -0
  113. data/lib/solargraph/source/chain/block_variable.rb +1 -1
  114. data/lib/solargraph/source/chain/call.rb +152 -69
  115. data/lib/solargraph/source/chain/constant.rb +15 -1
  116. data/lib/solargraph/source/chain/if.rb +23 -0
  117. data/lib/solargraph/source/chain/link.rb +17 -2
  118. data/lib/solargraph/source/chain/or.rb +2 -2
  119. data/lib/solargraph/source/chain/z_super.rb +3 -3
  120. data/lib/solargraph/source/chain.rb +85 -26
  121. data/lib/solargraph/source/change.rb +3 -0
  122. data/lib/solargraph/source/cursor.rb +16 -2
  123. data/lib/solargraph/source/source_chainer.rb +8 -5
  124. data/lib/solargraph/source/updater.rb +1 -0
  125. data/lib/solargraph/source.rb +120 -148
  126. data/lib/solargraph/source_map/clip.rb +16 -27
  127. data/lib/solargraph/source_map/data.rb +30 -0
  128. data/lib/solargraph/source_map/mapper.rb +15 -3
  129. data/lib/solargraph/source_map.rb +48 -24
  130. data/lib/solargraph/type_checker/checks.rb +10 -2
  131. data/lib/solargraph/type_checker/rules.rb +6 -1
  132. data/lib/solargraph/type_checker.rb +150 -39
  133. data/lib/solargraph/version.rb +1 -1
  134. data/lib/solargraph/views/environment.erb +3 -5
  135. data/lib/solargraph/workspace/config.rb +9 -6
  136. data/lib/solargraph/workspace.rb +30 -3
  137. data/lib/solargraph/yard_map/cache.rb +6 -0
  138. data/lib/solargraph/yard_map/helpers.rb +1 -1
  139. data/lib/solargraph/yard_map/mapper/to_method.rb +16 -3
  140. data/lib/solargraph/yard_map/mapper.rb +1 -1
  141. data/lib/solargraph/yard_map/to_method.rb +11 -4
  142. data/lib/solargraph/yard_map.rb +1 -292
  143. data/lib/solargraph/yard_tags.rb +20 -0
  144. data/lib/solargraph/yardoc.rb +52 -0
  145. data/lib/solargraph.rb +6 -4
  146. data/solargraph.gemspec +7 -6
  147. metadata +71 -82
  148. data/lib/solargraph/api_map/bundler_methods.rb +0 -22
  149. data/lib/solargraph/documentor.rb +0 -76
  150. data/lib/solargraph/language_server/host/cataloger.rb +0 -56
  151. data/lib/solargraph/parser/legacy/node_methods.rb +0 -325
  152. data/lib/solargraph/parser/legacy/node_processors/alias_node.rb +0 -23
  153. data/lib/solargraph/parser/legacy/node_processors/args_node.rb +0 -50
  154. data/lib/solargraph/parser/legacy/node_processors/begin_node.rb +0 -15
  155. data/lib/solargraph/parser/legacy/node_processors/sym_node.rb +0 -18
  156. data/lib/solargraph/parser/legacy/node_processors.rb +0 -55
  157. data/lib/solargraph/parser/legacy.rb +0 -12
  158. data/lib/solargraph/parser/rubyvm/class_methods.rb +0 -153
  159. data/lib/solargraph/parser/rubyvm/node_chainer.rb +0 -160
  160. data/lib/solargraph/parser/rubyvm/node_methods.rb +0 -317
  161. data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +0 -85
  162. data/lib/solargraph/parser/rubyvm/node_processors/block_node.rb +0 -42
  163. data/lib/solargraph/parser/rubyvm/node_processors/casgn_node.rb +0 -33
  164. data/lib/solargraph/parser/rubyvm/node_processors/cvasgn_node.rb +0 -23
  165. data/lib/solargraph/parser/rubyvm/node_processors/def_node.rb +0 -75
  166. data/lib/solargraph/parser/rubyvm/node_processors/defs_node.rb +0 -68
  167. data/lib/solargraph/parser/rubyvm/node_processors/gvasgn_node.rb +0 -23
  168. data/lib/solargraph/parser/rubyvm/node_processors/ivasgn_node.rb +0 -38
  169. data/lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb +0 -39
  170. data/lib/solargraph/parser/rubyvm/node_processors/lit_node.rb +0 -20
  171. data/lib/solargraph/parser/rubyvm/node_processors/lvasgn_node.rb +0 -27
  172. data/lib/solargraph/parser/rubyvm/node_processors/namespace_node.rb +0 -39
  173. data/lib/solargraph/parser/rubyvm/node_processors/opt_arg_node.rb +0 -26
  174. data/lib/solargraph/parser/rubyvm/node_processors/orasgn_node.rb +0 -15
  175. data/lib/solargraph/parser/rubyvm/node_processors/resbody_node.rb +0 -51
  176. data/lib/solargraph/parser/rubyvm/node_processors/sclass_node.rb +0 -32
  177. data/lib/solargraph/parser/rubyvm/node_processors/scope_node.rb +0 -15
  178. data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +0 -279
  179. data/lib/solargraph/parser/rubyvm/node_processors.rb +0 -64
  180. data/lib/solargraph/parser/rubyvm/node_wrapper.rb +0 -47
  181. data/lib/solargraph/parser/rubyvm.rb +0 -40
  182. data/lib/solargraph/rbs_map/core_signs.rb +0 -33
  183. data/lib/yard-solargraph.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c031e57a0f9eb482a517ed584966ecfff9fd431aaee66d6c97d624393b56fb99
4
- data.tar.gz: d6cc56999dc9da2073584a54f5b2ed045e24e573c84408359a9c7f94f8bd8571
3
+ metadata.gz: 17844968917df55d45751cbe82fa1f59e72f4dbfe7ecce04f73dbccbc1ec2aeb
4
+ data.tar.gz: 1b86c653e3b5c145f1b0aa9c614f136bd6d75c305aeac680f0cfe992ca4ff3dc
5
5
  SHA512:
6
- metadata.gz: aa5be8998891287e3a92429f2317c3bc64235d71977476248cbf3ba1167842b2e65c666b7f1bb49254bcc9c1ad67b2f4ea7f4cd1c50ef3c16723bdbd5286049a
7
- data.tar.gz: 30b453fc424796b8b776d2c79b014d19645dd2f091fb6cb6822a6f373e1df719809d845bef66fc3146c821c42a7268f60ff65e034a93f5d51708e5a0028f7fb1
6
+ metadata.gz: 44d428aa78d2d82bcfb97b650acd72aaf904666702a59e13a87f1a4c4c8bb2fa171afe6f502fb7327a67f12854a3953fccee1fde95f75fc5cf4b4f8742683e8e
7
+ data.tar.gz: ce37d473c9e3b8decd9c97c868fb66ef8441e27aeb10b557abf345bba1ad9c96c8dc5657127ea9680dfa60f59da7663f25ccffed412d5683b272ea3dbf823f76
@@ -0,0 +1,40 @@
1
+ name: Plugin Backwards Compatibility Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: '3.0'
22
+ bundler-cache: false
23
+ - uses: awalsh128/cache-apt-pkgs-action@latest
24
+ with:
25
+ packages: yq
26
+ version: 1.0
27
+ - name: Install gems
28
+ run: |
29
+ echo 'gem "solargraph-rails"' > .Gemfile
30
+ echo 'gem "solargraph-rspec"' >> .Gemfile
31
+ bundle install
32
+ - name: Configure to use plugins
33
+ run: |
34
+ bundle exec solargraph config
35
+ yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
36
+ yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
37
+ - name: Ensure typechecking still works
38
+ run: bundle exec solargraph typecheck --level typed
39
+ - name: Ensure specs still run
40
+ run: bundle exec rake spec
@@ -22,7 +22,7 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'head']
25
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'head']
26
26
 
27
27
  steps:
28
28
  - uses: actions/checkout@v3
@@ -33,7 +33,5 @@ jobs:
33
33
  bundler-cache: false
34
34
  - name: Install gems
35
35
  run: bundle install
36
- - name: Set up yardocs
37
- run: bundle exec yard gems
38
36
  - name: Run tests
39
37
  run: bundle exec rspec
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with rspec.
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Typecheck
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: 3.4
30
+ bundler-cache: false
31
+ - name: Install gems
32
+ run: bundle install
33
+ - name: Typecheck self
34
+ run: bundle exec solargraph typecheck --level typed
data/.yardopts CHANGED
@@ -1,2 +1,2 @@
1
- lib/**/*.rb
2
- -e lib/yard-solargraph.rb
1
+ lib/**/*.rb
2
+ --plugin yard-solargraph
data/CHANGELOG.md CHANGED
@@ -1,3 +1,125 @@
1
+ ## 0.54.2 - April 28, 2025
2
+ - Resolve generics correctly on mixin inclusion (#898)
3
+ - Pick correct String#split overload (#905)
4
+ - Fix type sent into YARD method (#912)
5
+ - Early CancelRequest handling (#914)
6
+ - Destructure partial yield types (#915)
7
+ - Dependency versions (#916)
8
+
9
+ ## 0.54.1 - April 26, 2025
10
+ - Retire more RubyVM-specific code (#797)
11
+ - Add additional docs for key classes, modules and methods (#802)
12
+ - Populate location information from RBS files (#768)
13
+ - Consolidate parameter handling into Pin::Callable (#844)
14
+ - Adjust local variable presence to start after assignment, not before (#864)
15
+ - Resolve params from ref tags (#872)
16
+ - Reduce use of ComplexType.parse() to preserve rooted? information (#870)
17
+ - Ensure yield return types are qualified (#886)
18
+ - Understand type of 'def foo; @foo ||= bar; end' reader methods (#888)
19
+ - Improvements to #inspect output on pins and chains (#895)
20
+ - Block method resolution improvements (#885)
21
+ - Understand mass assignment into instance variables (#893)
22
+ - Library sync and cache invalidation (#903)
23
+ - Handle super and yield scenarios from blocks (#891)
24
+ - Allow core and stdlib documentation to be uncached (#899)
25
+ - Surface variable names in LSP, e.g., textDocument/hover (#910)
26
+ - Keep idle progress notifications alive (#911)
27
+
28
+ ## 0.54.0 - April 14, 2025
29
+ - Add support for simple block argument destructuring (#821)
30
+ - Benchmark the typecheck command (#852)
31
+ - Send Gem Caching Progress Notifications to LSP Clients (#855)
32
+ - [breaking] Fix more complex_type_spec.rb cases (#813)
33
+ - Mass assignment support - e.g., a, b = ['1', '2'] (#843)
34
+ - Memoize result of Chain#infer (#857)
35
+ - Ignore malformed mixins and overloads (#862)
36
+ - Drop Parser::ParserGem::ClassMethods#returns_from_node (#866)
37
+ - Refactor TypeChecker#argument_problems_for for type safety (#867)
38
+ - Specify more type behavior for variable reassignment (#863)
39
+ - One-step source synchronization (#871)
40
+ - Show cache progress in shell commands (#874)
41
+ - Fix miscellaneous scan errors (#875)
42
+ - Synchronous libraries (#876)
43
+ - Fix parsing of Set#classify method signature from RBS (#878)
44
+ - Sync Library#diagnose (#882)
45
+ - Doesn't false-alarm over splatted non-final args in typechecking (#883)
46
+ - Remove accidental inclusion of Module's methods in objects (#884)
47
+ - Remove another splat-related false alarm in strict typechecking (#889)
48
+ - Change require path `warn` to `debug` (#897)
49
+
50
+ ## 0.53.4 - March 30, 2025
51
+ - [regression] Restore 'Unresolved call' typecheck for stdlib objects (#849)
52
+ - Lazy dynamic rebinding (#851)
53
+ - Restore fill for Class#allocate (#848)
54
+ - [regression] Ensure YardMap gems have return type for Class<T>.new (#850)
55
+ - Create implicit .new pins in namespace method queries (#853)
56
+
57
+ ## 0.53.3 - March 29, 2025
58
+ - Remove redundant core fills (#824, #841)
59
+ - Resolve self type in variable assignments (#839)
60
+ - Eliminate splat-related false-alarms in strict typechecking (#840)
61
+ - Dynamic block binding with yieldreceiver (#842)
62
+ - Resolve generics by descending through context type (#847)
63
+
64
+ ## 0.53.2 - March 27, 2025
65
+ - Fix a self-type-related false-positive in strict typechecking (#834)
66
+ - DocMap fetches gem dependencies (#835)
67
+ - Use configured command path to spawn solargraph processes (#837)
68
+
69
+ ## 0.53.1 - March 26, 2025
70
+ - Reject nil requires in live code (#831)
71
+ - RbsMap adds mixins to current namespace (#832)
72
+
73
+ ## 0.53.0 - March 25, 2025
74
+ - Fix crash on generic methods (#762)
75
+ - Add more type annotations to the codebase (#763 et al.)
76
+ - Address remaining typecheck issues at 'typed' level and add CI task (#764)
77
+ - Fix crash during strict typechecking (#766)
78
+ - DeepInference: Fix some bugs, add docs, refactor (#767)
79
+ - Include "self type" methods like Enumerable#each from RBS files (#769)
80
+ - Handle RBS global, module alias, class variable and class instance variable declarations (#770)
81
+ - Add support for generic includes via RBS (#773)
82
+ - Handle parsing tuples of tuples in tags (#775)
83
+ - Retire the RubyVM parser (#776)
84
+ - Improve block handling in signature selection (#780)
85
+ - Require Ruby >= 3 (#791)
86
+ - Cache YARD and RBS (#781)
87
+ - Language server generates gem documentation in the background
88
+ - Fix bug handling Array(A, B) syntax while resolving generics (#784)
89
+ - Fix typeDefinitions for neovim (#792)
90
+ - Infer block-pass symbols (#793)
91
+ - Add #to_rbs methods to pins, use for better .inspect() output (#789)
92
+ - Remove deprecated commands (#790)
93
+ - Add :if support to NodeChainer for if statements as lvalues (#805)
94
+ - Fix ApiMap::Cache (#806)
95
+ - Map mixins from RBS (#808)
96
+ - Fix issue with wrong signature selection by call with block node (#815)
97
+ - Keep gem pins in memory (#811)
98
+ - Refactor gems command (#816)
99
+ - Use return type of literal blocks in inference (#818)
100
+ - Insert Module methods (#820)
101
+ - Revise documentation formatting (#823)
102
+
103
+ ## 0.52.0 - February 28, 2025
104
+ - Chains resolve identical names with different contexts (#679)
105
+ - Handle symbol tags in method tag values (#744)
106
+ - Infer more specific Array types when possible (#745)
107
+ - Handle interpolated symbol literals (#747)
108
+ - Handle combined conditions, else clauses in case statements (#746)
109
+ - fix: support find require xxx.rb in local workspace. (#722)
110
+ - Don't require redundant attribute @return and @param tags (#748)
111
+ - Use @yieldreturn tags for type inference (#749)
112
+ - Fix type annotations identified at 'typed' level (#750)
113
+ - Support RBS class aliases (#751)
114
+ - Better support for generics via Class @param tags (#743)
115
+ - Generic module support through RBS (#757)
116
+ - Fix inference of begin expression types (#754)
117
+ - Add argument to satisfy typechecker on which signature to use (#755)
118
+ - Fix RBS ingestion implicit initializer issues, missing param types (#756)
119
+ - Validate zsuper arity
120
+ - Use yard-solargraph plugin (#759)
121
+ - Add missing RBS types
122
+
1
123
  ## 0.51.2 - February 1, 2025
2
124
  - Fix exception from parser when anonymous block forwarding is used (#740)
3
125
  - Parameterized Object types
@@ -5,10 +127,10 @@
5
127
 
6
128
  ## 0.51.1 - January 23, 2025
7
129
  - Format example code
8
- - Block infers yieldself from chain
130
+ - Block infers yieldreceiver from chain
9
131
 
10
132
  ## 0.51.0 - January 19, 2025
11
- - Resolve self in yieldself tags
133
+ - Resolve self in yieldreceiver tags
12
134
  - Include absolute paths in config (#674)
13
135
  - Enable diagnostics by default
14
136
  - Fix cache resolution (#704)
@@ -597,7 +719,7 @@
597
719
  ## 0.31.2 - January 27, 2019
598
720
  - Use YARD documentation rules to associate directives with namespaces
599
721
  - Handle non-unique pin locations in completionItem/resolve
600
- - Clip#complete handles @yieldself and @yieldpublic contexts
722
+ - Clip#complete handles @yieldreceiver and @yieldpublic contexts
601
723
  - Host::Dispatch filters library updates (castwide/vscode-solargraph#99)
602
724
  - Qualify included namespaces (#148)
603
725
 
@@ -953,7 +1075,7 @@
953
1075
 
954
1076
  ## 0.17.0 - February 1, 2018
955
1077
  - Support Solargraph configurations in workspace folders.
956
- - Use @yieldself tag to change block contexts.
1078
+ - Use @yieldreceiver tag to change block contexts.
957
1079
  - Handle whitespace in signatures.
958
1080
  - Convert 'self' when inferring signature types.
959
1081
  - Handle bare periods without signatures.
@@ -996,7 +1118,7 @@
996
1118
  - Map pins to code objects.
997
1119
  - Infer return types from domain (DSL) methods.
998
1120
  - Fixed visibility and results for superclasses.
999
- - Experimental @yieldself tag.
1121
+ - Experimental @yieldreceiver tag.
1000
1122
  - Improved syntax error handling in Source.fix.
1001
1123
  - Gem ships with Ruby 2.2.2 yardocs.
1002
1124
  - Experimental plugin architecture and Runtime plugin.
data/README.md CHANGED
@@ -34,6 +34,7 @@ Plug-ins and extensions are available for the following editors:
34
34
  * Instructions: https://lsp.sublimetext.io/language_servers/#solargraph
35
35
 
36
36
  * **Vim**
37
+ * Github: `nvim-lspconfig`, https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#solargraph
37
38
  * GitHub: `LanguageClient-neovim`, https://github.com/autozimu/LanguageClient-neovim
38
39
  * GitHub: `coc`, https://github.com/neoclide/coc-solargraph
39
40
  * GitHub: `Vim-EasyComplete`, https://github.com/jayli/vim-easycomplete
@@ -50,12 +51,19 @@ Plug-ins and extensions are available for the following editors:
50
51
 
51
52
  Solargraph's behavior can be controlled via optional [configuration](https://solargraph.org/guides/configuration) files. The highest priority file is a `.solargraph.yml` file at the root of the project. If not present, any global configuration at `~/.config/solargraph/config.yml` will apply. The path to the global configuration can be overridden with the `SOLARGRAPH_GLOBAL_CONFIG` environment variable.
52
53
 
53
- ### Rails Support
54
+ ### Plugins
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.
57
+
54
58
  For better Rails support, please consider using [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails/)
55
59
 
60
+ The RSpec framework is supported via [solargraph-rspec](https://github.com/lekemula/solargraph-rspec/)
61
+
56
62
  ### Gem Support
57
63
 
58
- Solargraph is capable of providing code completion and documentation for gems that have YARD documentation. You can make sure your gems are documented by running `yard gems` from the command line. (YARD is included as one of Solargraph's gem dependencies. The first time you run it might take a while if you have a lot of gems installed).
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
+
66
+ Solargraph automatically generates code maps from installed gems. You can also manage your cached gem documentation with the `solargraph gems` command.
59
67
 
60
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.
61
69
 
@@ -65,22 +73,11 @@ If your project automatically requires bundled gems (e.g., `require 'bundler/req
65
73
 
66
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.
67
75
 
68
- ### Updating Core Documentation
69
-
70
- As of version 0.49.0, Solargraph uses [rbs](https://github.com/ruby/rbs) for core and stdlib documentation. The following only applies to prior versions.
71
-
72
- The Solargraph gem ships with documentation for Ruby 2.2.2. You can download documentation for other Ruby versions from the command line.
73
-
74
- $ solargraph list-cores # List the installed documentation versions
75
- $ solargraph available-cores # List the versions available for download
76
- $ solargraph download-core # Install the best match for your Ruby version
77
- $ solargraph clear # Reset the documentation cache
78
-
79
76
  ### The Documentation Cache
80
77
 
81
- Solargraph uses a cache directory to store documentation for the Ruby core and customized documentation for certain gems. The default location is `~/.solargraph/cache`, e.g., `/home/<username>/.solargraph/cache` on Linux or `C:\Users\<username>\.solargraph` on Windows.
78
+ Solargraph uses a cache directory to store documentation for the Ruby core and gems. The default location is `~/.cache/solargraph`, e.g., `/home/<username>/.cache/solargraph` on Linux or `C:\Users\<username>\.cache\solargraph` on Windows.
82
79
 
83
- You can change the location of the cache directory with the `SOLARGRAPH_CACHE` environment variable. This can be useful if you want the cache to comply with the XDG Base Directory Specification.
80
+ You can change the location of the cache directory with the `SOLARGRAPH_CACHE` environment variable.
84
81
 
85
82
  ### Solargraph and Bundler
86
83
 
@@ -90,7 +87,7 @@ In the Gemfile:
90
87
 
91
88
  gem 'solargraph', group: :development
92
89
 
93
- Run `bundle install` and use `bundle exec yard gems` to generate the documentation. This process documents cached or vendored gems, or even gems that are installed from a local path.
90
+ Run `bundle install` and optionally use `bundle exec solargraph gems` to generate the documentation. This process documents cached or vendored gems, or even gems that are installed from a local path.
94
91
 
95
92
  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`.
96
93
 
data/SPONSORS.md CHANGED
@@ -4,13 +4,7 @@ Solargraph is developed and maintained by [Castwide Technologies](https://castwi
4
4
 
5
5
  The following people and organizations provide funding or other resources. [Become a sponsor](https://patreon.com/castwide)
6
6
 
7
- ## Linked Sponsors
8
-
9
- - **[Calyptix Security](https://www.calyptix.com/)**
10
-
11
7
  ## Named Sponsors
12
8
 
13
- - Akira Yamada
14
- - Joel Drapper
15
- - Spencer
9
+ - Juan Carlos
16
10
  - Vince Broz
@@ -4,66 +4,96 @@ module Solargraph
4
4
  class ApiMap
5
5
  class Cache
6
6
  def initialize
7
+ # @type [Hash{Array => Array<Pin::Method>}]
7
8
  @methods = {}
9
+ # @type [Hash{(String, Array<String>) => Array<Pin::Base>}]
8
10
  @constants = {}
11
+ # @type [Hash{(String, String) => String}]
9
12
  @qualified_namespaces = {}
13
+ # @type [Hash{String => Pin::Method}]
10
14
  @receiver_definitions = {}
15
+ # @type [Hash{String => SourceMap::Clip}]
16
+ @clips = {}
11
17
  end
12
18
 
19
+ # @param fqns [String]
20
+ # @param scope [Symbol]
21
+ # @param visibility [Array<Symbol>]
22
+ # @param deep [Boolean]
13
23
  # @return [Array<Pin::Method>]
14
24
  def get_methods fqns, scope, visibility, deep
15
- @methods[[fqns, scope, visibility.sort, deep]]
25
+ @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"]
16
26
  end
17
27
 
28
+ # @param fqns [String]
29
+ # @param scope [Symbol]
30
+ # @param visibility [Array<Symbol>]
31
+ # @param deep [Boolean]
32
+ # @param value [Array<Pin::Method>]
33
+ # @return [void]
18
34
  def set_methods fqns, scope, visibility, deep, value
19
- @methods[[fqns, scope, visibility.sort, deep]] = value
35
+ @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] = value
20
36
  end
21
37
 
38
+ # @param namespace [String]
39
+ # @param contexts [Array<String>]
22
40
  # @return [Array<Pin::Base>]
23
- def get_constants namespace, context
24
- @constants[[namespace, context]]
41
+ def get_constants namespace, contexts
42
+ @constants["#{namespace}|#{contexts}"]
25
43
  end
26
44
 
27
- def set_constants namespace, context, value
28
- @constants[[namespace, context]] = value
45
+ # @param namespace [String]
46
+ # @param contexts [Array<String>]
47
+ # @param value [Array<Pin::Base>]
48
+ # @return [void]
49
+ def set_constants namespace, contexts, value
50
+ @constants["#{namespace}|#{contexts}"] = value
29
51
  end
30
52
 
53
+ # @param name [String]
54
+ # @param context [String]
31
55
  # @return [String]
32
56
  def get_qualified_namespace name, context
33
- @qualified_namespaces[[name, context]]
57
+ @qualified_namespaces["#{name}|#{context}"]
34
58
  end
35
59
 
60
+ # @param name [String]
61
+ # @param context [String]
62
+ # @param value [String]
63
+ # @return [void]
36
64
  def set_qualified_namespace name, context, value
37
- @qualified_namespaces[[name, context]] = value
38
- end
39
-
40
- def receiver_defined? path
41
- @receiver_definitions.key? path
65
+ @qualified_namespaces["#{name}|#{context}"] = value
42
66
  end
43
67
 
68
+ # @param path [String]
44
69
  # @return [Pin::Method]
45
70
  def get_receiver_definition path
46
71
  @receiver_definitions[path]
47
72
  end
48
73
 
74
+ # @param path [String]
75
+ # @param pin [Pin::Method]
76
+ # @return [void]
49
77
  def set_receiver_definition path, pin
50
78
  @receiver_definitions[path] = pin
51
79
  end
52
80
 
53
81
  # @return [void]
54
82
  def clear
55
- @methods.clear
56
- @constants.clear
57
- @qualified_namespaces.clear
58
- @receiver_definitions.clear
83
+ return if empty?
84
+
85
+ all_caches.each(&:clear)
59
86
  end
60
87
 
61
88
  # @return [Boolean]
62
89
  def empty?
63
- @methods.empty? &&
64
- @constants.empty? &&
65
- @qualified_namespaces.empty? &&
66
- @receiver_definitions.empty?
90
+ all_caches.all?(&:empty?)
91
+ end
92
+
93
+ private
94
+
95
+ def all_caches
96
+ [@methods, @constants, @qualified_namespaces, @receiver_definitions, @clips]
67
97
  end
68
98
  end
69
99
  end
@@ -6,10 +6,13 @@ module Solargraph
6
6
 
7
7
  # Get the YARD CodeObject at the specified path.
8
8
  #
9
+ # @generic T
9
10
  # @param path [String]
10
- # @return [YARD::CodeObjects::Base]
11
- def code_object_at path
12
- code_object_map[path]
11
+ # @param klass [Class<generic<T>>]
12
+ # @return [generic<T>, nil]
13
+ def code_object_at path, klass = YARD::CodeObjects::Base
14
+ obj = code_object_map[path]
15
+ obj if obj&.is_a?(klass)
13
16
  end
14
17
 
15
18
  # @return [Array<String>]
@@ -41,11 +44,13 @@ module Solargraph
41
44
  end
42
45
  code_object_map[pin.path].docstring = pin.docstring
43
46
  store.get_includes(pin.path).each do |ref|
44
- code_object_map[pin.path].instance_mixins.push code_object_map[ref] unless code_object_map[ref].nil? or code_object_map[pin.path].nil?
47
+ include_object = code_object_at(pin.path, YARD::CodeObjects::ClassObject)
48
+ include_object.instance_mixins.push code_object_map[ref] unless include_object.nil? or include_object.nil?
45
49
  end
46
50
  store.get_extends(pin.path).each do |ref|
47
- code_object_map[pin.path].instance_mixins.push code_object_map[ref] unless code_object_map[ref].nil? or code_object_map[pin.path].nil?
48
- code_object_map[pin.path].class_mixins.push code_object_map[ref] unless code_object_map[ref].nil? or code_object_map[pin.path].nil?
51
+ extend_object = code_object_at(pin.path, YARD::CodeObjects::ClassObject)
52
+ extend_object.instance_mixins.push code_object_map[ref] unless extend_object.nil? or extend_object.nil?
53
+ extend_object.class_mixins.push code_object_map[ref] unless extend_object.nil? or extend_object.nil?
49
54
  end
50
55
  end
51
56
  store.method_pins.each do |pin|
@@ -53,13 +58,15 @@ module Solargraph
53
58
  code_object_map[pin.path] ||= pin.code_object
54
59
  next
55
60
  end
56
- code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(code_object_at(pin.namespace), pin.name, pin.scope) { |obj|
61
+
62
+ code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(code_object_at(pin.namespace, YARD::CodeObjects::NamespaceObject), pin.name, pin.scope) { |obj|
57
63
  next if pin.location.nil? || pin.location.filename.nil?
58
64
  obj.add_file pin.location.filename, pin.location.range.start.line
59
65
  }
60
- code_object_map[pin.path].docstring = pin.docstring
61
- code_object_map[pin.path].visibility = pin.visibility || :public
62
- code_object_map[pin.path].parameters = pin.parameters.map do |p|
66
+ method_object = code_object_at(pin.path, YARD::CodeObjects::MethodObject)
67
+ method_object.docstring = pin.docstring
68
+ method_object.visibility = pin.visibility || :public
69
+ method_object.parameters = pin.parameters.map do |p|
63
70
  [p.name, p.asgn_code]
64
71
  end
65
72
  end