solargraph 0.58.1 → 0.59.0.dev.1

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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +3 -0
  3. data/.github/workflows/linting.yml +4 -5
  4. data/.github/workflows/plugins.yml +40 -36
  5. data/.github/workflows/rspec.yml +45 -13
  6. data/.github/workflows/typecheck.yml +2 -2
  7. data/.rubocop_todo.yml +27 -49
  8. data/README.md +3 -3
  9. data/Rakefile +1 -0
  10. data/lib/solargraph/api_map/cache.rb +110 -110
  11. data/lib/solargraph/api_map/constants.rb +289 -279
  12. data/lib/solargraph/api_map/index.rb +204 -193
  13. data/lib/solargraph/api_map/source_to_yard.rb +109 -97
  14. data/lib/solargraph/api_map/store.rb +387 -384
  15. data/lib/solargraph/api_map.rb +1000 -945
  16. data/lib/solargraph/complex_type/conformance.rb +176 -0
  17. data/lib/solargraph/complex_type/type_methods.rb +242 -228
  18. data/lib/solargraph/complex_type/unique_type.rb +632 -482
  19. data/lib/solargraph/complex_type.rb +549 -444
  20. data/lib/solargraph/convention/data_definition/data_definition_node.rb +93 -91
  21. data/lib/solargraph/convention/data_definition.rb +108 -105
  22. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +62 -61
  23. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +103 -102
  24. data/lib/solargraph/convention/struct_definition.rb +168 -164
  25. data/lib/solargraph/diagnostics/require_not_found.rb +54 -53
  26. data/lib/solargraph/diagnostics/rubocop.rb +119 -118
  27. data/lib/solargraph/diagnostics/rubocop_helpers.rb +70 -68
  28. data/lib/solargraph/diagnostics/type_check.rb +56 -55
  29. data/lib/solargraph/doc_map.rb +200 -439
  30. data/lib/solargraph/equality.rb +34 -34
  31. data/lib/solargraph/gem_pins.rb +97 -98
  32. data/lib/solargraph/language_server/host/dispatch.rb +131 -130
  33. data/lib/solargraph/language_server/host/message_worker.rb +113 -112
  34. data/lib/solargraph/language_server/host/sources.rb +100 -99
  35. data/lib/solargraph/language_server/host.rb +883 -878
  36. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +109 -114
  37. data/lib/solargraph/language_server/message/extended/document.rb +24 -23
  38. data/lib/solargraph/language_server/message/text_document/completion.rb +58 -56
  39. data/lib/solargraph/language_server/message/text_document/definition.rb +42 -40
  40. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +28 -26
  41. data/lib/solargraph/language_server/message/text_document/formatting.rb +150 -148
  42. data/lib/solargraph/language_server/message/text_document/hover.rb +60 -58
  43. data/lib/solargraph/language_server/message/text_document/signature_help.rb +25 -24
  44. data/lib/solargraph/language_server/message/text_document/type_definition.rb +27 -25
  45. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +25 -23
  46. data/lib/solargraph/library.rb +729 -683
  47. data/lib/solargraph/location.rb +87 -82
  48. data/lib/solargraph/logging.rb +57 -37
  49. data/lib/solargraph/parser/comment_ripper.rb +76 -69
  50. data/lib/solargraph/parser/flow_sensitive_typing.rb +483 -255
  51. data/lib/solargraph/parser/node_processor/base.rb +122 -92
  52. data/lib/solargraph/parser/node_processor.rb +63 -62
  53. data/lib/solargraph/parser/parser_gem/class_methods.rb +167 -149
  54. data/lib/solargraph/parser/parser_gem/node_chainer.rb +191 -166
  55. data/lib/solargraph/parser/parser_gem/node_methods.rb +506 -486
  56. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +22 -22
  57. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +61 -59
  58. data/lib/solargraph/parser/parser_gem/node_processors/begin_node.rb +24 -15
  59. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +46 -46
  60. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +60 -53
  61. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +53 -23
  62. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +41 -40
  63. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +30 -29
  64. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +61 -59
  65. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +98 -98
  66. data/lib/solargraph/parser/parser_gem/node_processors/or_node.rb +22 -0
  67. data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +17 -17
  68. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +39 -38
  69. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +53 -52
  70. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +296 -291
  71. data/lib/solargraph/parser/parser_gem/node_processors/when_node.rb +23 -0
  72. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +33 -29
  73. data/lib/solargraph/parser/parser_gem/node_processors.rb +74 -70
  74. data/lib/solargraph/parser/region.rb +75 -69
  75. data/lib/solargraph/parser/snippet.rb +17 -17
  76. data/lib/solargraph/pin/base.rb +761 -729
  77. data/lib/solargraph/pin/base_variable.rb +418 -126
  78. data/lib/solargraph/pin/block.rb +126 -104
  79. data/lib/solargraph/pin/breakable.rb +13 -9
  80. data/lib/solargraph/pin/callable.rb +278 -231
  81. data/lib/solargraph/pin/closure.rb +68 -72
  82. data/lib/solargraph/pin/common.rb +94 -79
  83. data/lib/solargraph/pin/compound_statement.rb +55 -0
  84. data/lib/solargraph/pin/conversions.rb +124 -123
  85. data/lib/solargraph/pin/delegated_method.rb +131 -120
  86. data/lib/solargraph/pin/documenting.rb +115 -114
  87. data/lib/solargraph/pin/instance_variable.rb +38 -34
  88. data/lib/solargraph/pin/keyword.rb +16 -20
  89. data/lib/solargraph/pin/local_variable.rb +31 -75
  90. data/lib/solargraph/pin/method.rb +720 -672
  91. data/lib/solargraph/pin/method_alias.rb +42 -34
  92. data/lib/solargraph/pin/namespace.rb +121 -115
  93. data/lib/solargraph/pin/parameter.rb +338 -275
  94. data/lib/solargraph/pin/proxy_type.rb +40 -39
  95. data/lib/solargraph/pin/reference/override.rb +47 -47
  96. data/lib/solargraph/pin/reference/superclass.rb +17 -15
  97. data/lib/solargraph/pin/reference.rb +41 -39
  98. data/lib/solargraph/pin/search.rb +62 -61
  99. data/lib/solargraph/pin/signature.rb +69 -61
  100. data/lib/solargraph/pin/symbol.rb +53 -53
  101. data/lib/solargraph/pin/until.rb +18 -18
  102. data/lib/solargraph/pin/while.rb +18 -18
  103. data/lib/solargraph/pin.rb +46 -44
  104. data/lib/solargraph/pin_cache.rb +665 -245
  105. data/lib/solargraph/position.rb +118 -119
  106. data/lib/solargraph/range.rb +112 -112
  107. data/lib/solargraph/rbs_map/conversions.rb +846 -823
  108. data/lib/solargraph/rbs_map/core_map.rb +65 -58
  109. data/lib/solargraph/rbs_map/stdlib_map.rb +72 -43
  110. data/lib/solargraph/rbs_map.rb +217 -163
  111. data/lib/solargraph/shell.rb +397 -352
  112. data/lib/solargraph/source/chain/call.rb +372 -337
  113. data/lib/solargraph/source/chain/constant.rb +28 -26
  114. data/lib/solargraph/source/chain/hash.rb +35 -34
  115. data/lib/solargraph/source/chain/if.rb +29 -28
  116. data/lib/solargraph/source/chain/instance_variable.rb +34 -13
  117. data/lib/solargraph/source/chain/literal.rb +53 -48
  118. data/lib/solargraph/source/chain/or.rb +31 -23
  119. data/lib/solargraph/source/chain.rb +294 -291
  120. data/lib/solargraph/source/change.rb +89 -82
  121. data/lib/solargraph/source/cursor.rb +172 -166
  122. data/lib/solargraph/source/source_chainer.rb +204 -194
  123. data/lib/solargraph/source/updater.rb +59 -55
  124. data/lib/solargraph/source.rb +524 -498
  125. data/lib/solargraph/source_map/clip.rb +237 -226
  126. data/lib/solargraph/source_map/data.rb +37 -34
  127. data/lib/solargraph/source_map/mapper.rb +282 -259
  128. data/lib/solargraph/source_map.rb +220 -212
  129. data/lib/solargraph/type_checker/problem.rb +34 -32
  130. data/lib/solargraph/type_checker/rules.rb +157 -84
  131. data/lib/solargraph/type_checker.rb +895 -814
  132. data/lib/solargraph/version.rb +1 -1
  133. data/lib/solargraph/workspace/config.rb +257 -255
  134. data/lib/solargraph/workspace/gemspecs.rb +367 -0
  135. data/lib/solargraph/workspace/require_paths.rb +98 -97
  136. data/lib/solargraph/workspace.rb +362 -220
  137. data/lib/solargraph/yard_map/helpers.rb +45 -44
  138. data/lib/solargraph/yard_map/mapper/to_method.rb +134 -130
  139. data/lib/solargraph/yard_map/mapper/to_namespace.rb +32 -31
  140. data/lib/solargraph/yard_map/mapper.rb +84 -79
  141. data/lib/solargraph/yardoc.rb +97 -87
  142. data/lib/solargraph.rb +126 -105
  143. data/rbs/fills/rubygems/0/dependency.rbs +193 -0
  144. data/rbs/fills/tuple/tuple.rbs +28 -0
  145. data/rbs/shims/ast/0/node.rbs +5 -0
  146. data/rbs/shims/diff-lcs/1.5/diff-lcs.rbs +11 -0
  147. data/rbs_collection.yaml +1 -1
  148. data/solargraph.gemspec +2 -1
  149. metadata +22 -17
  150. data/lib/solargraph/type_checker/checks.rb +0 -124
  151. data/lib/solargraph/type_checker/param_def.rb +0 -37
  152. data/lib/solargraph/yard_map/to_method.rb +0 -89
  153. data/sig/shims/ast/0/node.rbs +0 -5
  154. /data/{sig → rbs}/shims/ast/2.4/.rbs_meta.yaml +0 -0
  155. /data/{sig → rbs}/shims/ast/2.4/ast.rbs +0 -0
  156. /data/{sig → rbs}/shims/parser/3.2.0.1/builders/default.rbs +0 -0
  157. /data/{sig → rbs}/shims/parser/3.2.0.1/manifest.yaml +0 -0
  158. /data/{sig → rbs}/shims/parser/3.2.0.1/parser.rbs +0 -0
  159. /data/{sig → rbs}/shims/parser/3.2.0.1/polyfill.rbs +0 -0
  160. /data/{sig → rbs}/shims/thor/1.2.0.1/.rbs_meta.yaml +0 -0
  161. /data/{sig → rbs}/shims/thor/1.2.0.1/manifest.yaml +0 -0
  162. /data/{sig → rbs}/shims/thor/1.2.0.1/thor.rbs +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31aee8c6c10b4c153a7cdd4da7c5d94748b702234df69302dc642d5956b87320
4
- data.tar.gz: 9579e90add3bb40c8a0c348a2111f6b4626f6bf7a5fd11a4d5d35aa4fa8d98b5
3
+ metadata.gz: 9687e639cdba08f45193d8d5f8c3e63dfa97c0bfe2a690ff46691727e9df61bc
4
+ data.tar.gz: 794c8e32a02bec6a290e8987b1ecdaace50a4e55f304ade073e3c67b7e009111
5
5
  SHA512:
6
- metadata.gz: feb5d83ea7f7143805119c52e77c6109f454a3b46485b2a574a2a53c2bd726b040310f6bc5a874044798f5ac40b8dd015b38d67204d2b9343f601a0e74385154
7
- data.tar.gz: '09a728082ed231fd8dd93c8ba2c1480727e75c91ac92c11ef752e3a228729c357f9c7b9d4a9536ff0a1c92278a1c2904a86964206c7fc0293cd82226693c165d'
6
+ metadata.gz: df7c80cc6b287dee199586993bd04c008f661da431f20866a49b9d95d556f60dae8c21eef5e7a8bfcb84fb2f6fc563400e4dbccc7133afc673ad71461de2a1b8
7
+ data.tar.gz: 9a965abc25768f1c4f1171c1ed587b4a12260a878fd3bf198afc54df41083c7a4ae4ba6c6e4a26cc7e1c7ed0f332605bdd8921379a61af9258b4e8f5ae4bcc96
data/.envrc ADDED
@@ -0,0 +1,3 @@
1
+ # current git branch
2
+ SOLARGRAPH_FORCE_VERSION=0.0.1.dev-$(git rev-parse --abbrev-ref HEAD | tr -d '\n' | tr -d '/' | tr -d '-'| tr -d '_')
3
+ export SOLARGRAPH_FORCE_VERSION
@@ -8,10 +8,10 @@ name: Linting
8
8
  on:
9
9
  workflow_dispatch: {}
10
10
  pull_request:
11
- branches: [ master ]
11
+ branches: ['*']
12
12
  push:
13
13
  branches:
14
- - 'main'
14
+ - 'master'
15
15
  tags:
16
16
  - 'v*'
17
17
 
@@ -31,13 +31,12 @@ jobs:
31
31
  - uses: ruby/setup-ruby@v1
32
32
  with:
33
33
  ruby-version: 3.4
34
- bundler: latest
35
34
  bundler-cache: true
36
- cache-version: 2025-06-06
35
+ cache-version: 2026-01-11
37
36
 
38
37
  - name: Update to best available RBS
39
38
  run: |
40
- bundle update rbs # use latest available for this Ruby version
39
+ bundle update --pre rbs # use latest available for this Ruby version
41
40
 
42
41
  - name: Restore cache of gem annotations
43
42
  id: dot-cache-restore
@@ -9,7 +9,7 @@ on:
9
9
  push:
10
10
  branches: [master]
11
11
  pull_request:
12
- branches: [master]
12
+ branches: ['*']
13
13
 
14
14
  permissions:
15
15
  contents: read
@@ -23,7 +23,7 @@ jobs:
23
23
  - name: Set up Ruby
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
26
- ruby-version: 3.4
26
+ ruby-version: 3.4 # keep same as typecheck.yml
27
27
  bundler-cache: true
28
28
  - uses: awalsh128/cache-apt-pkgs-action@latest
29
29
  with:
@@ -34,7 +34,7 @@ jobs:
34
34
  echo 'gem "solargraph-rails"' > .Gemfile
35
35
  echo 'gem "solargraph-rspec"' >> .Gemfile
36
36
  bundle install
37
- bundle update rbs
37
+ bundle update --pre rbs
38
38
  - name: Configure to use plugins
39
39
  run: |
40
40
  bundle exec solargraph config
@@ -43,7 +43,7 @@ jobs:
43
43
  - name: Install gem types
44
44
  run: bundle exec rbs collection update
45
45
  - name: Ensure typechecking still works
46
- run: bundle exec solargraph typecheck --level typed
46
+ run: bundle exec solargraph typecheck --level strong
47
47
  - name: Ensure specs still run
48
48
  run: bundle exec rake spec
49
49
  rails:
@@ -54,7 +54,9 @@ jobs:
54
54
  - name: Set up Ruby
55
55
  uses: ruby/setup-ruby@v1
56
56
  with:
57
- ruby-version: 3.4
57
+ ruby-version: 3.4 # keep same as typecheck.yml
58
+ # See https://github.com/castwide/solargraph/actions/runs/19000135777/job/54265647107?pr=1119
59
+ rubygems: latest
58
60
  bundler-cache: false
59
61
  - uses: awalsh128/cache-apt-pkgs-action@latest
60
62
  with:
@@ -64,7 +66,7 @@ jobs:
64
66
  run: |
65
67
  echo 'gem "solargraph-rails"' > .Gemfile
66
68
  bundle install
67
- bundle update rbs
69
+ bundle update --pre rbs
68
70
  - name: Configure to use plugins
69
71
  run: |
70
72
  bundle exec solargraph config
@@ -72,7 +74,7 @@ jobs:
72
74
  - name: Install gem types
73
75
  run: bundle exec rbs collection update
74
76
  - name: Ensure typechecking still works
75
- run: bundle exec solargraph typecheck --level typed
77
+ run: bundle exec solargraph typecheck --level strong
76
78
  - name: Ensure specs still run
77
79
  run: bundle exec rake spec
78
80
  rspec:
@@ -83,7 +85,7 @@ jobs:
83
85
  - name: Set up Ruby
84
86
  uses: ruby/setup-ruby@v1
85
87
  with:
86
- ruby-version: 3.4
88
+ ruby-version: 3.4 # keep same as typecheck.yml
87
89
  bundler-cache: false
88
90
  - uses: awalsh128/cache-apt-pkgs-action@latest
89
91
  with:
@@ -93,7 +95,7 @@ jobs:
93
95
  run: |
94
96
  echo 'gem "solargraph-rspec"' >> .Gemfile
95
97
  bundle install
96
- bundle update rbs
98
+ bundle update --pre rbs
97
99
  - name: Configure to use plugins
98
100
  run: |
99
101
  bundle exec solargraph config
@@ -101,7 +103,7 @@ jobs:
101
103
  - name: Install gem types
102
104
  run: bundle exec rbs collection update
103
105
  - name: Ensure typechecking still works
104
- run: bundle exec solargraph typecheck --level typed
106
+ run: bundle exec solargraph typecheck --level strong
105
107
  - name: Ensure specs still run
106
108
  run: bundle exec rake spec
107
109
 
@@ -116,47 +118,47 @@ jobs:
116
118
  - name: clone https://github.com/lekemula/solargraph-rspec/
117
119
  run: |
118
120
  cd ..
119
- # git clone https://github.com/lekemula/solargraph-rspec.git
121
+ git clone https://github.com/lekemula/solargraph-rspec.git
120
122
 
121
- # pending https://github.com/lekemula/solargraph-rspec/pull/30
122
- git clone https://github.com/apiology/solargraph-rspec.git
123
123
  cd solargraph-rspec
124
- git checkout reset_closures
125
124
  - name: Set up Ruby
126
125
  uses: ruby/setup-ruby@v1
127
126
  with:
128
- ruby-version: '3.1'
127
+ ruby-version: 3.4
129
128
  rubygems: latest
130
129
  bundler-cache: false
131
130
  - name: Install gems
132
131
  run: |
133
- set -x
132
+ set -x
134
133
 
135
- cd ../solargraph-rspec
136
- echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
137
- bundle config path ${{ env.BUNDLE_PATH }}
138
- bundle install --jobs 4 --retry 3
139
- bundle exec appraisal install
140
- # @todo some kind of appraisal/bundle conflict?
141
- # https://github.com/castwide/solargraph/actions/runs/19038710934/job/54369767122?pr=1116
142
- # /home/runner/work/solargraph/solargraph-rspec/vendor/bundle/ruby/3.1.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:317:in
143
- # `check_for_activated_spec!': You have already activated date
144
- # 3.5.0, but your Gemfile requires date 3.4.1. Prepending
145
- # `bundle exec` to your command may solve
146
- # this. (Gem::LoadError)
147
- bundle exec appraisal update date
148
- # For some reason on ruby 3.1 it defaults to an old version: 1.3.2
149
- # https://github.com/lekemula/solargraph-rspec/actions/runs/17814581205/job/50645370316?pr=22
150
- # We update manually to the latest
151
- bundle exec appraisal update rspec-rails
134
+ cd ../solargraph-rspec
135
+ echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
136
+ bundle config path ${{ env.BUNDLE_PATH }}
137
+ bundle install --jobs 4 --retry 3
138
+ bundle exec appraisal install
139
+ # @todo some kind of appraisal/bundle conflict?
140
+ # https://github.com/castwide/solargraph/actions/runs/19038710934/job/54369767122?pr=1116
141
+ # /home/runner/work/solargraph/solargraph-rspec/vendor/bundle/ruby/3.1.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:317:in
142
+ # `check_for_activated_spec!': You have already activated date
143
+ # 3.5.0, but your Gemfile requires date 3.4.1. Prepending
144
+ # `bundle exec` to your command may solve
145
+ # this. (Gem::LoadError)
146
+ bundle exec appraisal update date
147
+ # For some reason on ruby 3.1 it defaults to an old version: 1.3.2
148
+ # https://github.com/lekemula/solargraph-rspec/actions/runs/17814581205/job/50645370316?pr=22
149
+ # We update manually to the latest
150
+ bundle exec appraisal update rspec-rails
152
151
  - name: Configure .solargraph.yml
153
152
  run: |
154
153
  cd ../solargraph-rspec
155
154
  cp .solargraph.yml.example .solargraph.yml
156
- - name: Solargraph generate RSpec gems YARD and RBS pins
155
+ - name: Solargraph generate RSpec gems YARD pins
157
156
  run: |
158
157
  cd ../solargraph-rspec
159
- bundle exec appraisal rbs collection update
158
+ # solargraph-rspec's specs don't pass a workspace, so it
159
+ # doesn't know where to look for the RBS collection - let's
160
+ # not load one so that the solargraph gems command below works
161
+
160
162
  rspec_gems=$(bundle exec appraisal ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
161
163
  bundle exec appraisal solargraph gems $rspec_gems
162
164
  - name: Run specs
@@ -180,6 +182,8 @@ jobs:
180
182
  # solargraph-rails supports Ruby 3.0+
181
183
  ruby-version: '3.0'
182
184
  bundler-cache: false
185
+ # https://github.com/apiology/solargraph/actions/runs/19400815835/job/55508092473?pr=17
186
+ rubygems: latest
183
187
  bundler: latest
184
188
  env:
185
189
  MATRIX_RAILS_VERSION: "7.0"
@@ -191,7 +195,7 @@ jobs:
191
195
  cd ../solargraph-rails
192
196
  echo "gem 'solargraph', path: '${GITHUB_WORKSPACE:?}'" >> Gemfile
193
197
  bundle install
194
- bundle update rbs
198
+ bundle update --pre rbs
195
199
  RAILS_DIR="$(pwd)/spec/rails7"
196
200
  export RAILS_DIR
197
201
  cd ${RAILS_DIR}
@@ -11,7 +11,7 @@ on:
11
11
  push:
12
12
  branches: [ master ]
13
13
  pull_request:
14
- branches: [ master ]
14
+ branches: ['*']
15
15
 
16
16
  permissions:
17
17
  contents: read
@@ -21,20 +21,49 @@ jobs:
21
21
  runs-on: ubuntu-latest
22
22
  strategy:
23
23
  matrix:
24
- ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
25
- rbs-version: ['3.6.1', '3.9.5', '4.0.0.dev.4']
24
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'head']
25
+ rbs-version: ['3.6.1', '3.8.1', '3.9.5', '3.10.0', '4.0.0.dev.5']
26
26
  # Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
27
27
  exclude:
28
+ # only include the 3.0 variants we include later
28
29
  - ruby-version: '3.0'
29
- rbs-version: '3.9.5'
30
- - ruby-version: '3.0'
31
- rbs-version: '4.0.0.dev.4'
32
- # Missing require in 'rbs collection update' - hopefully
33
- # fixed in next RBS release
30
+ # only include the 3.1 variants we include later
31
+ - ruby-version: '3.1'
32
+ # only include the 3.2 variants we include later
33
+ - ruby-version: '3.2'
34
+ # only include the 3.3 variants we include later
35
+ - ruby-version: '3.3'
36
+ # only include the 3.4 variants we include later
37
+ - ruby-version: '3.4'
38
+ # only include the 4.0 variants we include later
34
39
  - ruby-version: '4.0'
40
+ # Don't exclude 'head' - let's test all RBS versions we
41
+ # can there.
42
+ #
43
+ #
44
+ # Just exclude some odd-ball compatibility issues we can't
45
+ # work around:
46
+ #
47
+ # https://github.com/castwide/solargraph/actions/runs/20627923548/job/59241444380?pr=1102
48
+ - ruby-version: 'head'
35
49
  rbs-version: '3.6.1'
50
+ - ruby-version: 'head'
51
+ rbs-version: '3.8.1'
52
+ include:
53
+ - ruby-version: '3.0'
54
+ rbs-version: '3.6.1'
55
+ - ruby-version: '3.1'
56
+ rbs-version: '3.6.1'
57
+ - ruby-version: '3.2'
58
+ rbs-version: '3.8.1'
59
+ - ruby-version: '3.3'
60
+ rbs-version: '3.9.5'
61
+ - ruby-version: '3.3'
62
+ rbs-version: '3.10.0'
63
+ - ruby-version: '3.4'
64
+ rbs-version: '4.0.0.dev.5'
36
65
  - ruby-version: '4.0'
37
- rbs-version: '4.0.0.dev.4'
66
+ rbs-version: '4.0.0.dev.5'
38
67
  steps:
39
68
  - uses: actions/checkout@v3
40
69
  - name: Set up Ruby
@@ -58,11 +87,8 @@ jobs:
58
87
  run: |
59
88
  bundle _2.5.23_ install
60
89
  bundle update rbs # use latest available for this Ruby version
61
- bundle list
62
- bundle exec solargraph pin 'Bundler::Dsl#source'
63
90
  - name: Update types
64
- run: |
65
- bundle exec rbs collection update
91
+ run: bundle exec rbs collection update
66
92
  - name: Run tests
67
93
  run: bundle exec rake spec
68
94
  undercover:
@@ -77,9 +103,15 @@ jobs:
77
103
  uses: ruby/setup-ruby@v1
78
104
  with:
79
105
  ruby-version: '3.4'
106
+ # see https://github.com/castwide/solargraph/actions/runs/19391419903/job/55485410493?pr=1119
107
+ #
108
+ # match version in Gemfile.lock and use same version below
109
+ bundler: 2.5.23
80
110
  bundler-cache: false
81
111
  - name: Install gems
82
112
  run: bundle install
113
+ - name: Update types
114
+ run: bundle exec rbs collection update
83
115
  - name: Run tests
84
116
  run: bundle exec rake spec
85
117
  - name: Check PR coverage
@@ -11,7 +11,7 @@ on:
11
11
  push:
12
12
  branches: [ master ]
13
13
  pull_request:
14
- branches: [ master ]
14
+ branches: ['*']
15
15
 
16
16
  permissions:
17
17
  contents: read
@@ -32,7 +32,7 @@ jobs:
32
32
  - name: Install gems
33
33
  run: |
34
34
  bundle install
35
- bundle update rbs # use latest available for this Ruby version
35
+ bundle update --pre rbs # use latest available for this Ruby version
36
36
  - name: Install gem types
37
37
  run: bundle exec rbs collection install
38
38
  - name: Typecheck self
data/.rubocop_todo.yml CHANGED
@@ -80,7 +80,6 @@ Layout/ElseAlignment:
80
80
  # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
81
81
  Layout/EmptyLineBetweenDefs:
82
82
  Exclude:
83
- - 'lib/solargraph/doc_map.rb'
84
83
  - 'lib/solargraph/language_server/message/initialize.rb'
85
84
  - 'lib/solargraph/pin/delegated_method.rb'
86
85
 
@@ -107,7 +106,6 @@ Layout/EndOfLine:
107
106
  Exclude:
108
107
  - 'Gemfile'
109
108
  - 'Rakefile'
110
- - 'lib/solargraph/source/encoding_fixes.rb'
111
109
  - 'solargraph.gemspec'
112
110
 
113
111
  # This cop supports safe autocorrection (--autocorrect).
@@ -200,7 +198,6 @@ Layout/MultilineMethodCallIndentation:
200
198
  # SupportedStyles: aligned, indented
201
199
  Layout/MultilineOperationIndentation:
202
200
  Exclude:
203
- - 'lib/solargraph/api_map.rb'
204
201
  - 'lib/solargraph/language_server/host/dispatch.rb'
205
202
  - 'lib/solargraph/source.rb'
206
203
 
@@ -215,11 +212,6 @@ Layout/SpaceAfterComma:
215
212
  Layout/SpaceAroundEqualsInParameterDefault:
216
213
  Enabled: false
217
214
 
218
- # This cop supports safe autocorrection (--autocorrect).
219
- Layout/SpaceAroundKeyword:
220
- Exclude:
221
- - 'spec/rbs_map/conversions_spec.rb'
222
-
223
215
  # This cop supports safe autocorrection (--autocorrect).
224
216
  # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
225
217
  # SupportedStylesForExponentOperator: space, no_space
@@ -362,7 +354,6 @@ Lint/NonAtomicFileOperation:
362
354
  # This cop supports safe autocorrection (--autocorrect).
363
355
  Lint/ParenthesesAsGroupedExpression:
364
356
  Exclude:
365
- - 'lib/solargraph.rb'
366
357
  - 'lib/solargraph/parser/parser_gem/node_chainer.rb'
367
358
  - 'spec/language_server/host_spec.rb'
368
359
  - 'spec/source_map/clip_spec.rb'
@@ -431,12 +422,6 @@ Lint/UnusedBlockArgument:
431
422
  Lint/UnusedMethodArgument:
432
423
  Enabled: false
433
424
 
434
- # This cop supports safe autocorrection (--autocorrect).
435
- # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
436
- Lint/UselessAccessModifier:
437
- Exclude:
438
- - 'lib/solargraph/api_map.rb'
439
-
440
425
  # This cop supports safe autocorrection (--autocorrect).
441
426
  Lint/UselessAssignment:
442
427
  Enabled: false
@@ -457,7 +442,7 @@ Metrics/AbcSize:
457
442
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
458
443
  # AllowedMethods: refine
459
444
  Metrics/BlockLength:
460
- Max: 56
445
+ Max: 57
461
446
 
462
447
  # Configuration parameters: CountBlocks, CountModifierForms.
463
448
  Metrics/BlockNesting:
@@ -468,6 +453,7 @@ Metrics/ClassLength:
468
453
  Exclude:
469
454
  - 'lib/solargraph/api_map.rb'
470
455
  - 'lib/solargraph/language_server/host.rb'
456
+ - 'lib/solargraph/pin/method.rb'
471
457
  - 'lib/solargraph/rbs_map/conversions.rb'
472
458
  - 'lib/solargraph/type_checker.rb'
473
459
 
@@ -487,10 +473,10 @@ Metrics/ModuleLength:
487
473
  Metrics/ParameterLists:
488
474
  Exclude:
489
475
  - 'lib/solargraph/api_map.rb'
476
+ - 'lib/solargraph/parser/node_processor.rb'
490
477
  - 'lib/solargraph/pin/callable.rb'
491
478
  - 'lib/solargraph/type_checker.rb'
492
479
  - 'lib/solargraph/yard_map/mapper/to_method.rb'
493
- - 'lib/solargraph/yard_map/to_method.rb'
494
480
 
495
481
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
496
482
  Metrics/PerceivedComplexity:
@@ -522,7 +508,12 @@ Naming/MemoizedInstanceVariableName:
522
508
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
523
509
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
524
510
  Naming/MethodParameterName:
525
- Enabled: false
511
+ Exclude:
512
+ - 'lib/solargraph/parser/parser_gem/node_chainer.rb'
513
+ - 'lib/solargraph/pin/base.rb'
514
+ - 'lib/solargraph/range.rb'
515
+ - 'lib/solargraph/source.rb'
516
+ - 'lib/solargraph/yard_map/mapper/to_method.rb'
526
517
 
527
518
  # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
528
519
  # AllowedMethods: call
@@ -553,7 +544,6 @@ Naming/VariableName:
553
544
  RSpec/Be:
554
545
  Exclude:
555
546
  - 'spec/rbs_map/stdlib_map_spec.rb'
556
- - 'spec/rbs_map_spec.rb'
557
547
  - 'spec/source/source_chainer_spec.rb'
558
548
 
559
549
  # This cop supports unsafe autocorrection (--autocorrect-all).
@@ -576,7 +566,6 @@ RSpec/BeforeAfterAll:
576
566
  - '**/spec/rails_helper.rb'
577
567
  - '**/spec/support/**/*.rb'
578
568
  - 'spec/api_map_spec.rb'
579
- - 'spec/doc_map_spec.rb'
580
569
  - 'spec/language_server/host/dispatch_spec.rb'
581
570
  - 'spec/language_server/protocol_spec.rb'
582
571
 
@@ -623,7 +612,6 @@ RSpec/ExampleWording:
623
612
  # This cop supports safe autocorrection (--autocorrect).
624
613
  RSpec/ExcessiveDocstringSpacing:
625
614
  Exclude:
626
- - 'spec/rbs_map/conversions_spec.rb'
627
615
  - 'spec/source/chain/call_spec.rb'
628
616
 
629
617
  # This cop supports safe autocorrection (--autocorrect).
@@ -639,21 +627,10 @@ RSpec/ExpectActual:
639
627
  RSpec/HookArgument:
640
628
  Enabled: false
641
629
 
642
- # This cop supports safe autocorrection (--autocorrect).
643
- # Configuration parameters: .
644
- # SupportedStyles: is_expected, should
645
- RSpec/ImplicitExpect:
646
- EnforcedStyle: should
647
-
648
630
  # Configuration parameters: AssignmentOnly.
649
631
  RSpec/InstanceVariable:
650
632
  Enabled: false
651
633
 
652
- # This cop supports safe autocorrection (--autocorrect).
653
- RSpec/LeadingSubject:
654
- Exclude:
655
- - 'spec/rbs_map/conversions_spec.rb'
656
-
657
634
  RSpec/LeakyConstantDeclaration:
658
635
  Exclude:
659
636
  - 'spec/complex_type_spec.rb'
@@ -688,7 +665,12 @@ RSpec/NotToNot:
688
665
  - 'spec/rbs_map/core_map_spec.rb'
689
666
 
690
667
  RSpec/PendingWithoutReason:
691
- Enabled: false
668
+ Exclude:
669
+ - 'spec/api_map_spec.rb'
670
+ - 'spec/doc_map_spec.rb'
671
+ - 'spec/pin/base_variable_spec.rb'
672
+ - 'spec/pin/local_variable_spec.rb'
673
+ - 'spec/type_checker/levels/strict_spec.rb'
692
674
 
693
675
  # This cop supports unsafe autocorrection (--autocorrect-all).
694
676
  # Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
@@ -760,7 +742,6 @@ Style/AndOr:
760
742
  # RedundantBlockArgumentNames: blk, block, proc
761
743
  Style/ArgumentsForwarding:
762
744
  Exclude:
763
- - 'lib/solargraph/api_map.rb'
764
745
  - 'lib/solargraph/complex_type.rb'
765
746
 
766
747
  # This cop supports safe autocorrection (--autocorrect).
@@ -838,7 +819,6 @@ Style/EmptyLambdaParameter:
838
819
  Style/EmptyMethod:
839
820
  Exclude:
840
821
  - 'lib/solargraph/language_server/message/client/register_capability.rb'
841
- - 'lib/solargraph/pin/base.rb'
842
822
  - 'spec/fixtures/formattable.rb'
843
823
  - 'spec/fixtures/rdoc-lib/lib/example.rb'
844
824
  - 'spec/fixtures/workspace-with-gemfile/lib/thing.rb'
@@ -942,7 +922,6 @@ Style/MapIntoArray:
942
922
  Exclude:
943
923
  - 'lib/solargraph/diagnostics/update_errors.rb'
944
924
  - 'lib/solargraph/parser/parser_gem/node_chainer.rb'
945
- - 'lib/solargraph/type_checker/param_def.rb'
946
925
 
947
926
  # This cop supports unsafe autocorrection (--autocorrect-all).
948
927
  Style/MapToHash:
@@ -1016,7 +995,6 @@ Style/Next:
1016
995
  - 'lib/solargraph/parser/parser_gem/node_processors/send_node.rb'
1017
996
  - 'lib/solargraph/pin/signature.rb'
1018
997
  - 'lib/solargraph/source_map/clip.rb'
1019
- - 'lib/solargraph/type_checker/checks.rb'
1020
998
 
1021
999
  # This cop supports safe autocorrection (--autocorrect).
1022
1000
  # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
@@ -1112,7 +1090,6 @@ Style/RedundantRegexpEscape:
1112
1090
  Style/RedundantReturn:
1113
1091
  Exclude:
1114
1092
  - 'lib/solargraph/complex_type/type_methods.rb'
1115
- - 'lib/solargraph/doc_map.rb'
1116
1093
  - 'lib/solargraph/parser/parser_gem/node_methods.rb'
1117
1094
  - 'lib/solargraph/source/chain/z_super.rb'
1118
1095
 
@@ -1144,7 +1121,7 @@ Style/SafeNavigation:
1144
1121
  # Configuration parameters: Max.
1145
1122
  Style/SafeNavigationChainLength:
1146
1123
  Exclude:
1147
- - 'lib/solargraph/doc_map.rb'
1124
+ - 'lib/solargraph/workspace/gemspecs.rb'
1148
1125
 
1149
1126
  # This cop supports unsafe autocorrection (--autocorrect-all).
1150
1127
  Style/SlicingWithRange:
@@ -1153,7 +1130,12 @@ Style/SlicingWithRange:
1153
1130
  # This cop supports safe autocorrection (--autocorrect).
1154
1131
  # Configuration parameters: AllowModifier.
1155
1132
  Style/SoleNestedConditional:
1156
- Enabled: false
1133
+ Exclude:
1134
+ - 'lib/solargraph/complex_type/unique_type.rb'
1135
+ - 'lib/solargraph/pin/parameter.rb'
1136
+ - 'lib/solargraph/source.rb'
1137
+ - 'lib/solargraph/source/source_chainer.rb'
1138
+ - 'lib/solargraph/type_checker.rb'
1157
1139
 
1158
1140
  # This cop supports safe autocorrection (--autocorrect).
1159
1141
  Style/StderrPuts:
@@ -1175,7 +1157,6 @@ Style/StringLiterals:
1175
1157
  # This cop supports safe autocorrection (--autocorrect).
1176
1158
  Style/SuperArguments:
1177
1159
  Exclude:
1178
- - 'lib/solargraph/pin/base_variable.rb'
1179
1160
  - 'lib/solargraph/pin/callable.rb'
1180
1161
  - 'lib/solargraph/pin/method.rb'
1181
1162
  - 'lib/solargraph/pin/signature.rb'
@@ -1217,7 +1198,10 @@ Style/TrailingCommaInArrayLiteral:
1217
1198
  # Configuration parameters: EnforcedStyleForMultiline.
1218
1199
  # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
1219
1200
  Style/TrailingCommaInHashLiteral:
1220
- Enabled: false
1201
+ Exclude:
1202
+ - 'lib/solargraph/pin/callable.rb'
1203
+ - 'lib/solargraph/pin/closure.rb'
1204
+ - 'lib/solargraph/rbs_map/conversions.rb'
1221
1205
 
1222
1206
  # This cop supports safe autocorrection (--autocorrect).
1223
1207
  # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
@@ -1225,7 +1209,6 @@ Style/TrailingCommaInHashLiteral:
1225
1209
  Style/TrivialAccessors:
1226
1210
  Exclude:
1227
1211
  - 'lib/solargraph/language_server/message/extended/check_gem_version.rb'
1228
- - 'lib/solargraph/pin/keyword.rb'
1229
1212
 
1230
1213
  # This cop supports safe autocorrection (--autocorrect).
1231
1214
  Style/WhileUntilModifier:
@@ -1265,12 +1248,7 @@ YARD/MismatchName:
1265
1248
  Enabled: false
1266
1249
 
1267
1250
  YARD/TagTypeSyntax:
1268
- Exclude:
1269
- - 'lib/solargraph/api_map/constants.rb'
1270
- - 'lib/solargraph/language_server/host.rb'
1271
- - 'lib/solargraph/parser/comment_ripper.rb'
1272
- - 'lib/solargraph/pin/method.rb'
1273
- - 'lib/solargraph/type_checker.rb'
1251
+ Enabled: false
1274
1252
 
1275
1253
  # This cop supports safe autocorrection (--autocorrect).
1276
1254
  # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
data/README.md CHANGED
@@ -51,6 +51,8 @@ Plug-ins and extensions are available for the following editors:
51
51
 
52
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.
53
53
 
54
+ Use `bundle exec solargraph config` to create a configuration file.
55
+
54
56
  ### Plugins
55
57
 
56
58
  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.
@@ -132,9 +134,7 @@ See [https://solargraph.org/guides](https://solargraph.org/guides) for more tips
132
134
 
133
135
  ### Development
134
136
 
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.
137
+ To see more logging when typechecking or running specs, set the `SOLARGRAPH_LOG` environment variable to `debug` or `info`. `warn` is the default value.
138
138
 
139
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.
140
140
 
data/Rakefile CHANGED
@@ -63,6 +63,7 @@ def undercover
63
63
  status
64
64
  rescue StandardError => e
65
65
  warn "hit error: #{e.message}"
66
+ # @sg-ignore Need to add nil check here
66
67
  warn "Backtrace:\n#{e.backtrace.join("\n")}"
67
68
  warn "output: #{output}"
68
69
  puts "Flushing"