solargraph 0.47.2 → 0.53.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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/plugins.yml +40 -0
  4. data/.github/workflows/rspec.yml +4 -8
  5. data/.github/workflows/typecheck.yml +34 -0
  6. data/.yardopts +2 -2
  7. data/CHANGELOG.md +137 -3
  8. data/LICENSE +1 -1
  9. data/README.md +19 -16
  10. data/SPONSORS.md +2 -9
  11. data/lib/solargraph/api_map/cache.rb +60 -20
  12. data/lib/solargraph/api_map/source_to_yard.rb +17 -10
  13. data/lib/solargraph/api_map/store.rb +60 -12
  14. data/lib/solargraph/api_map.rb +171 -99
  15. data/lib/solargraph/bench.rb +3 -2
  16. data/lib/solargraph/cache.rb +77 -0
  17. data/lib/solargraph/complex_type/type_methods.rb +61 -12
  18. data/lib/solargraph/complex_type/unique_type.rb +193 -16
  19. data/lib/solargraph/complex_type.rb +113 -10
  20. data/lib/solargraph/convention/rakefile.rb +17 -0
  21. data/lib/solargraph/convention.rb +2 -3
  22. data/lib/solargraph/converters/dd.rb +5 -0
  23. data/lib/solargraph/converters/dl.rb +3 -0
  24. data/lib/solargraph/converters/dt.rb +3 -0
  25. data/lib/solargraph/diagnostics/rubocop.rb +23 -8
  26. data/lib/solargraph/diagnostics/rubocop_helpers.rb +4 -1
  27. data/lib/solargraph/diagnostics/type_check.rb +1 -0
  28. data/lib/solargraph/diagnostics.rb +2 -2
  29. data/lib/solargraph/doc_map.rb +171 -0
  30. data/lib/solargraph/gem_pins.rb +64 -0
  31. data/lib/solargraph/language_server/host/cataloger.rb +2 -1
  32. data/lib/solargraph/language_server/host/diagnoser.rb +2 -2
  33. data/lib/solargraph/language_server/host/dispatch.rb +15 -5
  34. data/lib/solargraph/language_server/host/message_worker.rb +4 -0
  35. data/lib/solargraph/language_server/host/sources.rb +7 -4
  36. data/lib/solargraph/language_server/host.rb +50 -26
  37. data/lib/solargraph/language_server/message/completion_item/resolve.rb +3 -1
  38. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +13 -1
  39. data/lib/solargraph/language_server/message/extended/download_core.rb +1 -5
  40. data/lib/solargraph/language_server/message/initialize.rb +13 -0
  41. data/lib/solargraph/language_server/message/initialized.rb +1 -0
  42. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +4 -1
  43. data/lib/solargraph/language_server/message/text_document/formatting.rb +4 -4
  44. data/lib/solargraph/language_server/message/text_document/hover.rb +2 -0
  45. data/lib/solargraph/language_server/message/text_document/signature_help.rb +1 -6
  46. data/lib/solargraph/language_server/message/text_document/type_definition.rb +24 -0
  47. data/lib/solargraph/language_server/message/text_document.rb +1 -1
  48. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +5 -0
  49. data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +10 -3
  50. data/lib/solargraph/language_server/message.rb +1 -0
  51. data/lib/solargraph/language_server/transport/adapter.rb +16 -1
  52. data/lib/solargraph/language_server/transport/data_reader.rb +2 -0
  53. data/lib/solargraph/library.rb +124 -37
  54. data/lib/solargraph/location.rb +1 -0
  55. data/lib/solargraph/page.rb +6 -0
  56. data/lib/solargraph/parser/comment_ripper.rb +4 -0
  57. data/lib/solargraph/parser/node_methods.rb +47 -7
  58. data/lib/solargraph/parser/node_processor/base.rb +9 -0
  59. data/lib/solargraph/parser/{legacy → parser_gem}/class_methods.rb +31 -5
  60. data/lib/solargraph/parser/{legacy → parser_gem}/flawed_builder.rb +3 -1
  61. data/lib/solargraph/parser/{legacy → parser_gem}/node_chainer.rb +57 -41
  62. data/lib/solargraph/parser/parser_gem/node_methods.rb +499 -0
  63. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/alias_node.rb +1 -1
  64. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +53 -0
  65. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/begin_node.rb +1 -1
  66. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/block_node.rb +3 -2
  67. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/casgn_node.rb +14 -4
  68. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/cvasgn_node.rb +1 -1
  69. data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/def_node.rb +7 -20
  70. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/defs_node.rb +2 -2
  71. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/gvasgn_node.rb +1 -1
  72. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/ivasgn_node.rb +2 -2
  73. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/lvasgn_node.rb +2 -2
  74. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/namespace_node.rb +2 -2
  75. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/orasgn_node.rb +1 -1
  76. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/resbody_node.rb +3 -3
  77. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +42 -0
  78. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/send_node.rb +2 -2
  79. data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/sym_node.rb +1 -1
  80. data/lib/solargraph/parser/parser_gem/node_processors.rb +54 -0
  81. data/lib/solargraph/parser/parser_gem.rb +12 -0
  82. data/lib/solargraph/parser/region.rb +1 -1
  83. data/lib/solargraph/parser/snippet.rb +2 -0
  84. data/lib/solargraph/parser.rb +9 -10
  85. data/lib/solargraph/pin/base.rb +69 -11
  86. data/lib/solargraph/pin/base_variable.rb +8 -4
  87. data/lib/solargraph/pin/block.rb +21 -28
  88. data/lib/solargraph/pin/closure.rb +17 -2
  89. data/lib/solargraph/pin/common.rb +7 -3
  90. data/lib/solargraph/pin/conversions.rb +34 -8
  91. data/lib/solargraph/pin/delegated_method.rb +97 -0
  92. data/lib/solargraph/pin/documenting.rb +25 -34
  93. data/lib/solargraph/pin/instance_variable.rb +4 -0
  94. data/lib/solargraph/pin/local_variable.rb +13 -1
  95. data/lib/solargraph/pin/method.rb +270 -16
  96. data/lib/solargraph/pin/namespace.rb +17 -1
  97. data/lib/solargraph/pin/parameter.rb +52 -17
  98. data/lib/solargraph/pin/reference/override.rb +2 -2
  99. data/lib/solargraph/pin/reference.rb +8 -0
  100. data/lib/solargraph/pin/search.rb +4 -4
  101. data/lib/solargraph/pin/signature.rb +143 -0
  102. data/lib/solargraph/pin.rb +2 -1
  103. data/lib/solargraph/range.rb +4 -6
  104. data/lib/solargraph/rbs_map/conversions.rb +601 -0
  105. data/lib/solargraph/rbs_map/core_fills.rb +47 -0
  106. data/lib/solargraph/rbs_map/core_map.rb +28 -0
  107. data/lib/solargraph/rbs_map/stdlib_map.rb +33 -0
  108. data/lib/solargraph/rbs_map.rb +84 -0
  109. data/lib/solargraph/shell.rb +69 -48
  110. data/lib/solargraph/source/chain/array.rb +32 -0
  111. data/lib/solargraph/source/chain/block_symbol.rb +13 -0
  112. data/lib/solargraph/source/chain/call.rb +125 -61
  113. data/lib/solargraph/source/chain/constant.rb +15 -1
  114. data/lib/solargraph/source/chain/if.rb +23 -0
  115. data/lib/solargraph/source/chain/link.rb +8 -2
  116. data/lib/solargraph/source/chain/or.rb +1 -1
  117. data/lib/solargraph/source/chain/z_super.rb +3 -3
  118. data/lib/solargraph/source/chain.rb +44 -14
  119. data/lib/solargraph/source/change.rb +3 -0
  120. data/lib/solargraph/source/cursor.rb +2 -0
  121. data/lib/solargraph/source/source_chainer.rb +8 -5
  122. data/lib/solargraph/source.rb +18 -19
  123. data/lib/solargraph/source_map/clip.rb +30 -23
  124. data/lib/solargraph/source_map/mapper.rb +20 -5
  125. data/lib/solargraph/source_map.rb +28 -13
  126. data/lib/solargraph/type_checker/checks.rb +10 -2
  127. data/lib/solargraph/type_checker.rb +201 -98
  128. data/lib/solargraph/version.rb +1 -1
  129. data/lib/solargraph/views/environment.erb +2 -2
  130. data/lib/solargraph/workspace/config.rb +14 -11
  131. data/lib/solargraph/workspace.rb +28 -17
  132. data/lib/solargraph/yard_map/cache.rb +6 -0
  133. data/lib/solargraph/yard_map/helpers.rb +1 -1
  134. data/lib/solargraph/yard_map/mapper/to_method.rb +18 -5
  135. data/lib/solargraph/yard_map/mapper.rb +1 -1
  136. data/lib/solargraph/yard_map/to_method.rb +11 -4
  137. data/lib/solargraph/yard_map.rb +1 -443
  138. data/lib/solargraph/yard_tags.rb +20 -0
  139. data/lib/solargraph/yardoc.rb +52 -0
  140. data/lib/solargraph.rb +8 -6
  141. data/solargraph.gemspec +19 -8
  142. metadata +162 -98
  143. data/.travis.yml +0 -19
  144. data/lib/solargraph/api_map/bundler_methods.rb +0 -22
  145. data/lib/solargraph/compat.rb +0 -37
  146. data/lib/solargraph/convention/rspec.rb +0 -30
  147. data/lib/solargraph/documentor.rb +0 -76
  148. data/lib/solargraph/parser/legacy/node_methods.rb +0 -325
  149. data/lib/solargraph/parser/legacy/node_processors/alias_node.rb +0 -23
  150. data/lib/solargraph/parser/legacy/node_processors/args_node.rb +0 -35
  151. data/lib/solargraph/parser/legacy/node_processors/begin_node.rb +0 -15
  152. data/lib/solargraph/parser/legacy/node_processors/def_node.rb +0 -63
  153. data/lib/solargraph/parser/legacy/node_processors/sclass_node.rb +0 -21
  154. data/lib/solargraph/parser/legacy/node_processors.rb +0 -54
  155. data/lib/solargraph/parser/legacy.rb +0 -12
  156. data/lib/solargraph/parser/rubyvm/class_methods.rb +0 -144
  157. data/lib/solargraph/parser/rubyvm/node_chainer.rb +0 -160
  158. data/lib/solargraph/parser/rubyvm/node_methods.rb +0 -315
  159. data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +0 -85
  160. data/lib/solargraph/parser/rubyvm/node_processors/block_node.rb +0 -42
  161. data/lib/solargraph/parser/rubyvm/node_processors/casgn_node.rb +0 -22
  162. data/lib/solargraph/parser/rubyvm/node_processors/cvasgn_node.rb +0 -23
  163. data/lib/solargraph/parser/rubyvm/node_processors/defs_node.rb +0 -57
  164. data/lib/solargraph/parser/rubyvm/node_processors/gvasgn_node.rb +0 -23
  165. data/lib/solargraph/parser/rubyvm/node_processors/ivasgn_node.rb +0 -38
  166. data/lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb +0 -39
  167. data/lib/solargraph/parser/rubyvm/node_processors/lit_node.rb +0 -20
  168. data/lib/solargraph/parser/rubyvm/node_processors/lvasgn_node.rb +0 -27
  169. data/lib/solargraph/parser/rubyvm/node_processors/namespace_node.rb +0 -39
  170. data/lib/solargraph/parser/rubyvm/node_processors/opt_arg_node.rb +0 -26
  171. data/lib/solargraph/parser/rubyvm/node_processors/orasgn_node.rb +0 -15
  172. data/lib/solargraph/parser/rubyvm/node_processors/resbody_node.rb +0 -45
  173. data/lib/solargraph/parser/rubyvm/node_processors/sclass_node.rb +0 -21
  174. data/lib/solargraph/parser/rubyvm/node_processors/scope_node.rb +0 -15
  175. data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +0 -277
  176. data/lib/solargraph/parser/rubyvm/node_processors/sym_node.rb +0 -18
  177. data/lib/solargraph/parser/rubyvm/node_processors.rb +0 -63
  178. data/lib/solargraph/parser/rubyvm.rb +0 -40
  179. data/lib/solargraph/yard_map/core_docs.rb +0 -170
  180. data/lib/solargraph/yard_map/core_fills.rb +0 -208
  181. data/lib/solargraph/yard_map/core_gen.rb +0 -76
  182. data/lib/solargraph/yard_map/rdoc_to_yard.rb +0 -140
  183. data/lib/solargraph/yard_map/stdlib_fills.rb +0 -43
  184. data/lib/yard-solargraph.rb +0 -33
  185. data/yardoc/2.2.2.tar.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d35030ae56f6aaff108a24e4fb06713f911ba4366feb2223b24ad0ea4568522
4
- data.tar.gz: a9eeaee16171bc762922ac55d10c61d53bcfe6ef1df0b20623c81e0978a80c7d
3
+ metadata.gz: c5f84e528dd40d7638e36189ca6b4dceccdfd1722a07bd1c1f060bf0265aa815
4
+ data.tar.gz: 39d6938ccabce6dda403c709711f6136472def5982222e73d89310eaeb906ee1
5
5
  SHA512:
6
- metadata.gz: 0b13ae6284def50f72c9aaed3cad6f89e879306dc8421b1c13f622e18181e6d9aaecf4f57ffa56601a00c92066557bb798d3e8ee6a397920ff0072f909e05463
7
- data.tar.gz: 9a0366309ebe9a4a784c2933a8452e2084c376ff9aa3cd6c3bf555f4d6ce046f11245679c688bef43c6c1e67d94b70afb4250149c9b01b80fc525b80a80b6486
6
+ metadata.gz: cf06b94032becde9f26b7d5cedcecbc0fd7d6bde539a980c748328f11165f91398605e7ff49af502b83a70a4aa9b32406c5846cda96f5246d20c97d17220700b
7
+ data.tar.gz: bdddccf5d52efd2a9be2b00ac473065ecca21d76646d59d247c5cb93b14de137ebfc16ec4ffbc3ed0d6e9de9f271e9763808775d6aa271496e6328bf70b443bf
@@ -0,0 +1 @@
1
+ patreon: castwide
@@ -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,20 +22,16 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0']
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
29
29
  - name: Set up Ruby
30
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
- # uses: ruby/setup-ruby@v1
33
- uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
30
+ uses: ruby/setup-ruby@v1
34
31
  with:
35
32
  ruby-version: ${{ matrix.ruby-version }}
36
33
  bundler-cache: false
37
- - run: bundle install
38
- - name: Set up yardocs
39
- run: bundle exec yard gems
34
+ - name: Install gems
35
+ run: bundle install
40
36
  - name: Run tests
41
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,137 @@
1
+ ## 0.53.3 - March 29, 2025
2
+ - Remove redundant core fills (#824, #841)
3
+ - Resolve self type in variable assignments (#839)
4
+ - Eliminate splat-related false-alarms in strict typechecking (#840)
5
+ - Dynamic block binding with yieldreceiver (#842)
6
+ - Resolve generics by descending through context type (#847)
7
+
8
+ ## 0.53.2 - March 27, 2025
9
+ - Fix a self-type-related false-positive in strict typechecking (#834)
10
+ - DocMap fetches gem dependencies (#835)
11
+ - Use configured command path to spawn solargraph processes (#837)
12
+
13
+ ## 0.53.1 - March 26, 2025
14
+ - Reject nil requires in live code (#831)
15
+ - RbsMap adds mixins to current namespace (#832)
16
+
17
+ ## 0.53.0 - March 25, 2025
18
+ - Fix crash on generic methods (#762)
19
+ - Add more type annotations to the codebase (#763 et al.)
20
+ - Address remaining typecheck issues at 'typed' level and add CI task (#764)
21
+ - Fix crash during strict typechecking (#766)
22
+ - DeepInference: Fix some bugs, add docs, refactor (#767)
23
+ - Include "self type" methods like Enumerable#each from RBS files (#769)
24
+ - Handle RBS global, module alias, class variable and class instance variable declarations (#770)
25
+ - Add support for generic includes via RBS (#773)
26
+ - Handle parsing tuples of tuples in tags (#775)
27
+ - Retire the RubyVM parser (#776)
28
+ - Improve block handling in signature selection (#780)
29
+ - Require Ruby >= 3 (#791)
30
+ - Cache YARD and RBS (#781)
31
+ - Language server generates gem documentation in the background
32
+ - Fix bug handling Array(A, B) syntax while resolving generics (#784)
33
+ - Fix typeDefinitions for neovim (#792)
34
+ - Infer block-pass symbols (#793)
35
+ - Add #to_rbs methods to pins, use for better .inspect() output (#789)
36
+ - Remove deprecated commands (#790)
37
+ - Add :if support to NodeChainer for if statements as lvalues (#805)
38
+ - Fix ApiMap::Cache (#806)
39
+ - Map mixins from RBS (#808)
40
+ - Fix issue with wrong signature selection by call with block node (#815)
41
+ - Keep gem pins in memory (#811)
42
+ - Refactor gems command (#816)
43
+ - Use return type of literal blocks in inference (#818)
44
+ - Insert Module methods (#820)
45
+ - Revise documentation formatting (#823)
46
+
47
+ ## 0.52.0 - February 28, 2025
48
+ - Chains resolve identical names with different contexts (#679)
49
+ - Handle symbol tags in method tag values (#744)
50
+ - Infer more specific Array types when possible (#745)
51
+ - Handle interpolated symbol literals (#747)
52
+ - Handle combined conditions, else clauses in case statements (#746)
53
+ - fix: support find require xxx.rb in local workspace. (#722)
54
+ - Don't require redundant attribute @return and @param tags (#748)
55
+ - Use @yieldreturn tags for type inference (#749)
56
+ - Fix type annotations identified at 'typed' level (#750)
57
+ - Support RBS class aliases (#751)
58
+ - Better support for generics via Class @param tags (#743)
59
+ - Generic module support through RBS (#757)
60
+ - Fix inference of begin expression types (#754)
61
+ - Add argument to satisfy typechecker on which signature to use (#755)
62
+ - Fix RBS ingestion implicit initializer issues, missing param types (#756)
63
+ - Validate zsuper arity
64
+ - Use yard-solargraph plugin (#759)
65
+ - Add missing RBS types
66
+
67
+ ## 0.51.2 - February 1, 2025
68
+ - Fix exception from parser when anonymous block forwarding is used (#740)
69
+ - Parameterized Object types
70
+ - Remove extraneous comment from method examples
71
+
72
+ ## 0.51.1 - January 23, 2025
73
+ - Format example code
74
+ - Block infers yieldreceiver from chain
75
+
76
+ ## 0.51.0 - January 19, 2025
77
+ - Resolve self in yieldreceiver tags
78
+ - Include absolute paths in config (#674)
79
+ - Enable diagnostics by default
80
+ - Fix cache resolution (#704)
81
+ - Modify rubocop option for rubocop < 1.30 (#665)
82
+ - Include absolute paths in config (#674)
83
+ - Enable diagnostics by default
84
+ - Remove RSpec convention (#716)
85
+ - Include convention pins in document_symbols (#724)
86
+ - Implement Go To Type Definition (#717)
87
+ - Remove e2mmap dependency (#699)
88
+ - Update rbs to 3.0
89
+ - Relax reverse_markdown dependency (#729)
90
+ - Fix Ruby 3.4 and move all parsing to whitequark (#739)
91
+ - Add Pin::DelegatedMethod (#602)
92
+ - Complete global methods from a file inside namespaces (#714)
93
+ - gemspec dashes and required path slashes (#697)
94
+
95
+ ## 0.50.0 - December 5, 2023
96
+ - Remove .travis.yml as its not longer used (#627)
97
+ - Fix empty string case when processing requires (#644)
98
+ - Fix scope() method call on wrong object (#670)
99
+ - Parse comments that start with multiple hashes (#667)
100
+ - Use XDG_CACHE_HOME if it exists (#664)
101
+ - Add rbs mention to readme (#693)
102
+ - Remove Atom from the readme (#692)
103
+ - Add more metadata to the gemspec (#691)
104
+ - Do not deprecate clear command
105
+ - Library#locate_ref returns nil for unresolved requires (#675)
106
+ - Hide deprecated commands
107
+ - List command
108
+ - Fixes (or ignores) ffi crash (#676)
109
+ - increase sleep time on cataloger (#677)
110
+ - YardMap ignores absolute paths (#678)
111
+ - Clarify macros vs. directives
112
+ - Infer complex types from method calls
113
+ - Default cache uses XDG_CACHE_HOME default (#664)
114
+
115
+ ## 0.49.0 - April 9, 2023
116
+ - Better union type handling
117
+ - First version of RBS support
118
+ - Dependency updates
119
+ - Update RuboCop config options
120
+ - RBS core and stdlib mapping
121
+ - Anonymous splats and multisig arity
122
+ - Infinite loop when checking if a class is a superclass (#641)
123
+
124
+ ## 0.48.0 - December 19, 2022
125
+ - Add Sublime Text to README (#604)
126
+ - Map nested constant assignments
127
+ - Handle rest/kwrest modifiers on overload arguments (#601)
128
+ - Make rubocop info severity Severity::HINT (#576)
129
+ - Process non-self singleton classes (#581)
130
+ - Fix nest gemspec dependency (#599)
131
+ - Strip 'file ' prefix from all filenames in RdocToYard (#585)
132
+ - Show why rubocop fails (#605)
133
+ - Link solargraph-rails (#611)
134
+
1
135
  ## 0.47.2 - September 30, 2022
2
136
  - Fix complex type inference (#578)
3
137
  - Off-by-one diagnostic (#595)
@@ -529,7 +663,7 @@
529
663
  ## 0.31.2 - January 27, 2019
530
664
  - Use YARD documentation rules to associate directives with namespaces
531
665
  - Handle non-unique pin locations in completionItem/resolve
532
- - Clip#complete handles @yieldself and @yieldpublic contexts
666
+ - Clip#complete handles @yieldreceiver and @yieldpublic contexts
533
667
  - Host::Dispatch filters library updates (castwide/vscode-solargraph#99)
534
668
  - Qualify included namespaces (#148)
535
669
 
@@ -885,7 +1019,7 @@
885
1019
 
886
1020
  ## 0.17.0 - February 1, 2018
887
1021
  - Support Solargraph configurations in workspace folders.
888
- - Use @yieldself tag to change block contexts.
1022
+ - Use @yieldreceiver tag to change block contexts.
889
1023
  - Handle whitespace in signatures.
890
1024
  - Convert 'self' when inferring signature types.
891
1025
  - Handle bare periods without signatures.
@@ -928,7 +1062,7 @@
928
1062
  - Map pins to code objects.
929
1063
  - Infer return types from domain (DSL) methods.
930
1064
  - Fixed visibility and results for superclasses.
931
- - Experimental @yieldself tag.
1065
+ - Experimental @yieldreceiver tag.
932
1066
  - Improved syntax error handling in Source.fix.
933
1067
  - Gem ships with Ruby 2.2.2 yardocs.
934
1068
  - Experimental plugin architecture and Runtime plugin.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017-2019 by Fred Snyder for Castwide Technologies
3
+ Copyright (c) 2017-2023 by Fred Snyder for Castwide Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -28,11 +28,13 @@ Plug-ins and extensions are available for the following editors:
28
28
  * Extension: https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
29
29
  * GitHub: https://github.com/castwide/vscode-solargraph
30
30
 
31
- * **Atom**
32
- * Package: https://atom.io/packages/ruby-solargraph
33
- * GitHub: https://github.com/castwide/atom-solargraph
31
+ * **Sublime Text**
32
+ * Extension: https://packagecontrol.io/packages/LSP
33
+ * GitHub: https://github.com/sublimelsp/LSP
34
+ * Instructions: https://lsp.sublimetext.io/language_servers/#solargraph
34
35
 
35
36
  * **Vim**
37
+ * Github: `nvim-lspconfig`, https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#solargraph
36
38
  * GitHub: `LanguageClient-neovim`, https://github.com/autozimu/LanguageClient-neovim
37
39
  * GitHub: `coc`, https://github.com/neoclide/coc-solargraph
38
40
  * GitHub: `Vim-EasyComplete`, https://github.com/jayli/vim-easycomplete
@@ -49,9 +51,19 @@ Plug-ins and extensions are available for the following editors:
49
51
 
50
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.
51
53
 
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
+
58
+ For better Rails support, please consider using [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails/)
59
+
60
+ The RSpec framework is supported via [solargraph-rspec](https://github.com/lekemula/solargraph-rspec/)
61
+
52
62
  ### Gem Support
53
63
 
54
- 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.
55
67
 
56
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.
57
69
 
@@ -61,20 +73,11 @@ If your project automatically requires bundled gems (e.g., `require 'bundler/req
61
73
 
62
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.
63
75
 
64
- ### Updating Core Documentation
65
-
66
- The Solargraph gem ships with documentation for Ruby 2.2.2. You can download documentation for other Ruby versions from the command line.
67
-
68
- $ solargraph list-cores # List the installed documentation versions
69
- $ solargraph available-cores # List the versions available for download
70
- $ solargraph download-core # Install the best match for your Ruby version
71
- $ solargraph clear # Reset the documentation cache
72
-
73
76
  ### The Documentation Cache
74
77
 
75
- 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.
76
79
 
77
- 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.
78
81
 
79
82
  ### Solargraph and Bundler
80
83
 
@@ -84,7 +87,7 @@ In the Gemfile:
84
87
 
85
88
  gem 'solargraph', group: :development
86
89
 
87
- 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.
88
91
 
89
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`.
90
93
 
data/SPONSORS.md CHANGED
@@ -4,14 +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
- - Tom de Grunt
14
- - Akira Yamada
15
- - Erlend Finvåg
16
- - Matt Massicotte
17
- - Oscar Rivas
9
+ - Juan Carlos
10
+ - Vince Broz
@@ -4,66 +4,106 @@ 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
 
81
+ # @param cursor [Source::Cursor]
82
+ # @return [SourceMap::Clip, nil]
83
+ def get_clip(cursor)
84
+ @clips["#{cursor.filename}|#{cursor.range.inspect}|#{cursor.node&.to_sexp}"]
85
+ end
86
+
87
+ # @param cursor [Source::Cursor]
88
+ # @param clip [SourceMap::Clip]
89
+ def set_clip(cursor, clip)
90
+ @clips["#{cursor.filename}|#{cursor.range.inspect}|#{cursor.node&.to_sexp}"] = clip
91
+ end
92
+
53
93
  # @return [void]
54
94
  def clear
55
- @methods.clear
56
- @constants.clear
57
- @qualified_namespaces.clear
58
- @receiver_definitions.clear
95
+ all_caches.each(&:clear)
59
96
  end
60
97
 
61
98
  # @return [Boolean]
62
99
  def empty?
63
- @methods.empty? &&
64
- @constants.empty? &&
65
- @qualified_namespaces.empty? &&
66
- @receiver_definitions.empty?
100
+ all_caches.all?(&:empty?)
101
+ end
102
+
103
+ private
104
+
105
+ def all_caches
106
+ [@methods, @constants, @qualified_namespaces, @receiver_definitions, @clips]
67
107
  end
68
108
  end
69
109
  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