solargraph 0.59.0.dev.2 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +3 -1
  3. data/.github/workflows/plugins.yml +8 -2
  4. data/.github/workflows/rspec.yml +6 -40
  5. data/.github/workflows/typecheck.yml +2 -1
  6. data/.rubocop.yml +6 -1
  7. data/.rubocop_todo.yml +3 -0
  8. data/CHANGELOG.md +15 -0
  9. data/lib/solargraph/api_map/constants.rb +0 -1
  10. data/lib/solargraph/api_map/index.rb +6 -0
  11. data/lib/solargraph/api_map/store.rb +6 -0
  12. data/lib/solargraph/api_map.rb +20 -4
  13. data/lib/solargraph/complex_type/type_methods.rb +2 -1
  14. data/lib/solargraph/complex_type/unique_type.rb +2 -4
  15. data/lib/solargraph/complex_type.rb +1 -1
  16. data/lib/solargraph/doc_map.rb +370 -131
  17. data/lib/solargraph/gem_pins.rb +16 -17
  18. data/lib/solargraph/library.rb +44 -66
  19. data/lib/solargraph/logging.rb +0 -2
  20. data/lib/solargraph/parser/flow_sensitive_typing.rb +0 -2
  21. data/lib/solargraph/parser/parser_gem/class_methods.rb +0 -2
  22. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +0 -1
  23. data/lib/solargraph/pin/base.rb +0 -2
  24. data/lib/solargraph/pin/method.rb +3 -0
  25. data/lib/solargraph/pin/reference/type_alias.rb +16 -0
  26. data/lib/solargraph/pin/reference.rb +1 -0
  27. data/lib/solargraph/pin_cache.rb +66 -480
  28. data/lib/solargraph/position.rb +7 -4
  29. data/lib/solargraph/rbs_map/conversions.rb +18 -18
  30. data/lib/solargraph/rbs_map.rb +2 -3
  31. data/lib/solargraph/shell.rb +163 -15
  32. data/lib/solargraph/source/chain.rb +3 -1
  33. data/lib/solargraph/source_map/mapper.rb +0 -2
  34. data/lib/solargraph/type_checker.rb +1 -2
  35. data/lib/solargraph/version.rb +1 -1
  36. data/lib/solargraph/workspace/config.rb +1 -1
  37. data/lib/solargraph/workspace/gemspecs.rb +2 -2
  38. data/lib/solargraph/workspace.rb +32 -129
  39. data/lib/solargraph/yard_map.rb +17 -18
  40. data/lib/solargraph/yardoc.rb +26 -33
  41. data/lib/solargraph.rb +2 -0
  42. data/solargraph.gemspec +2 -2
  43. metadata +6 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19ddbaec3539796c7153fbf1aff54f930614e54999b5f24a2b8e4ad478c6a2e7
4
- data.tar.gz: 90eae8d9572c92b8d850e610a7bb838154e6327c0635169812355d3838243f80
3
+ metadata.gz: 48702da784ad5e4ba9333e3389532a20af5bd0474cde01f0b00b9b07a53203ce
4
+ data.tar.gz: 93df9a47dde759e2de2f92f6e65609e4de5ba83403c4f481915e984d05111bab
5
5
  SHA512:
6
- metadata.gz: becab03886479b51dc82e71ee532204409c47693951d83c7c12fb17172ed16ab9684ac994b5450dac9cf8ee66796f44af5ad3f6f66de2d3e2786189421f262d9
7
- data.tar.gz: 826aee919004aa45ae2d5dec314d4e3d466e79771a7f2a56e1738de93ecabdf649a8b45162d605ed5b7ea9271db17015edc2dc7e8de9a8c6557aa9785ae8fa33
6
+ metadata.gz: 40c2a0be04ee36e8c0c7328e51e751c04becaddd5f405a302ec369bb7bae365705f75bf3852c1c99183e8ac00d58a61177216e75f60b2af9fb0d064c95496715
7
+ data.tar.gz: 41c1a1dd7c926debbb79a8f63b24e550d6b3a389ad71f09e392ce8216b66fa33b73d2a6269d5b624ecdf5aa86add0a81e40c2b3b24483a4555fb3a53d61e1e9c
@@ -36,7 +36,9 @@ jobs:
36
36
 
37
37
  - name: Update to best available RBS
38
38
  run: |
39
- bundle update --pre rbs # use latest available for this Ruby version
39
+ # Add optional gem to be able to typecheck related code
40
+ echo "gem 'vernier', '>1.0', '<2'" >> .Gemfile
41
+ bundle install
40
42
 
41
43
  - name: Restore cache of gem annotations
42
44
  id: dot-cache-restore
@@ -33,8 +33,9 @@ jobs:
33
33
  run: |
34
34
  echo 'gem "solargraph-rails"' > .Gemfile
35
35
  echo 'gem "solargraph-rspec"' >> .Gemfile
36
+ # Add optional gem to be able to typecheck related code
37
+ echo "gem 'vernier', '>1.0', '<2'" >> .Gemfile
36
38
  bundle install
37
- bundle update --pre rbs
38
39
  - name: Configure to use plugins
39
40
  run: |
40
41
  bundle exec solargraph config
@@ -65,6 +66,8 @@ jobs:
65
66
  - name: Install gems
66
67
  run: |
67
68
  echo 'gem "solargraph-rails"' > .Gemfile
69
+ # Add optional gem to be able to typecheck related code
70
+ echo "gem 'vernier', '>1.0', '<2'" >> .Gemfile
68
71
  bundle install
69
72
  bundle update --pre rbs
70
73
  - name: Configure to use plugins
@@ -94,6 +97,8 @@ jobs:
94
97
  - name: Install gems
95
98
  run: |
96
99
  echo 'gem "solargraph-rspec"' >> .Gemfile
100
+ # Add optional gem to be able to typecheck related code
101
+ echo "gem 'vernier', '>1.0', '<2'" >> .Gemfile
97
102
  bundle install
98
103
  bundle update --pre rbs
99
104
  - name: Configure to use plugins
@@ -183,7 +188,8 @@ jobs:
183
188
  uses: ruby/setup-ruby@v1
184
189
  with:
185
190
  # solargraph-rails supports Ruby 3.0+
186
- ruby-version: '3.0'
191
+ # This job uses 3.2 due to a problem compiling sqlite3 in earlier versions
192
+ ruby-version: '3.2'
187
193
  bundler-cache: false
188
194
  # https://github.com/apiology/solargraph/actions/runs/19400815835/job/55508092473?pr=17
189
195
  rubygems: latest
@@ -21,49 +21,15 @@ 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', 'head']
25
- rbs-version: ['3.6.1', '3.8.1', '3.9.5', '3.10.0', '4.0.0.dev.5']
26
- # Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
24
+ ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0', 'head']
25
+ rbs-version: ['3.10.0', '4.0.0', '4.0.1', '4.0.2']
27
26
  exclude:
28
- # only include the 3.0 variants we include later
29
- - ruby-version: '3.0'
30
- # only include the 3.1 variants we include later
31
27
  - 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
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'
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'
28
+ rbs-version: '4.0.0'
55
29
  - 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'
65
- - ruby-version: '4.0'
66
- rbs-version: '4.0.0.dev.5'
30
+ rbs-version: '4.0.1'
31
+ - ruby-version: '3.1'
32
+ rbs-version: '4.0.2'
67
33
  steps:
68
34
  - uses: actions/checkout@v3
69
35
  - name: Set up Ruby
@@ -31,8 +31,9 @@ jobs:
31
31
  bundler-cache: false
32
32
  - name: Install gems
33
33
  run: |
34
+ # Add optional gem to be able to typecheck related code
35
+ echo "gem 'vernier', '>1.0', '<2'" >> .Gemfile
34
36
  bundle install
35
- bundle update --pre rbs # use latest available for this Ruby version
36
37
  - name: Install gem types
37
38
  run: bundle exec rbs collection install
38
39
  - name: Typecheck self
data/.rubocop.yml CHANGED
@@ -19,7 +19,7 @@ AllCops:
19
19
  - "spec/fixtures/invalid_utf8.rb"
20
20
  - "vendor/**/*"
21
21
  - "vendor/**/.*"
22
- TargetRubyVersion: 3.0
22
+ TargetRubyVersion: 3.1
23
23
 
24
24
  Gemspec/RequiredRubyVersion:
25
25
  Exclude:
@@ -69,6 +69,11 @@ Metrics/ParameterLists:
69
69
  Style/ClassVars:
70
70
  Enabled: false
71
71
 
72
+ # Allow $stderr.puts for communication with users as 'warn' can be
73
+ # suppressed for unrelated reasons.
74
+ Style/StderrPuts:
75
+ Enabled: false
76
+
72
77
  #
73
78
  # Set a relaxed standard on harder-to-address item for ease of
74
79
  # contribution - if you are good at refactoring, we welcome PRs to
data/.rubocop_todo.yml CHANGED
@@ -361,3 +361,6 @@ YARD/TagTypeSyntax:
361
361
  # URISchemes: http, https
362
362
  Layout/LineLength:
363
363
  Max: 224
364
+
365
+ Naming/BlockForwarding:
366
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 0.59.0 - May 13, 2026
2
+ - Ensure pathname is required for rbs in shell caching processes (#1183)
3
+ - Pre-release branch 2026-01-12 (#1152)
4
+ - 2026-01-27 dev branch (#1165)
5
+ - Position linting (#1179)
6
+ - Revert YARD and RBS pin caching (#1180)
7
+ - Ensure pathname is required for rbs in shell caching processes (#1183)
8
+ - Limit default include glob to current directory (#1184)
9
+ - Require Ruby >= 3.1.0
10
+ - Require RBS >= 3.10.0
11
+ - Stub combine_same_type_arity_signatures (#1186)
12
+
13
+ ## 0.58.3 - March 9, 2026
14
+ - Ignore workspace dependencies in cache processes (#1174)
15
+
1
16
  ## 0.58.2 - January 19, 2026
2
17
  - Avoid rbs pollution (#1146)
3
18
  - Fix 'solargraph pin --references ClassName' private method call (#1150)
@@ -279,7 +279,6 @@ module Solargraph
279
279
  sc_ref = store.get_superclass(fqns)
280
280
  if sc_ref
281
281
  fqsc = dereference(sc_ref)
282
- # @sg-ignore Need to add nil check here
283
282
  result.concat inner_get_constants(fqsc, [:public], skip) unless %w[Object BasicObject].include?(fqsc)
284
283
  end
285
284
  result
@@ -36,6 +36,11 @@ module Solargraph
36
36
  @path_pin_hash ||= Hash.new { |h, k| h[k] = [] }
37
37
  end
38
38
 
39
+ # @return [Hash{String => ComplexType}]
40
+ def alias_hash
41
+ @alias_hash ||= {}
42
+ end
43
+
39
44
  # @generic T
40
45
  # @param klass [Class<generic<T>>]
41
46
  # @return [Set<generic<T>>]
@@ -133,6 +138,7 @@ module Solargraph
133
138
  map_references Pin::Reference::Extend, extend_references
134
139
  map_references Pin::Reference::Superclass, superclass_references
135
140
  map_overrides
141
+ pins_by_class(Pin::Reference::TypeAlias).each { |pin| alias_hash[pin.name] = pin.return_type }
136
142
  self
137
143
  end
138
144
 
@@ -271,6 +271,12 @@ module Solargraph
271
271
  @constants ||= Constants.new(self)
272
272
  end
273
273
 
274
+ # @param name [String]
275
+ # @return [ComplexType, nil]
276
+ def unalias name
277
+ index.alias_hash[name]
278
+ end
279
+
274
280
  private
275
281
 
276
282
  # @return [Index]
@@ -115,8 +115,9 @@ module Solargraph
115
115
  end
116
116
  unresolved_requires = (bench.external_requires + conventions_environ.requires + bench.workspace.config.required).to_a.compact.uniq
117
117
  recreate_docmap = @unresolved_requires != unresolved_requires ||
118
+ # @sg-ignore Unresolved call to rbs_collection_path on Solargraph::Workspace, nil
118
119
  workspace.rbs_collection_path != bench.workspace.rbs_collection_path ||
119
- @doc_map.any_uncached?
120
+ @doc_map.uncached_gemspecs.any?
120
121
 
121
122
  if recreate_docmap
122
123
  @doc_map = DocMap.new(unresolved_requires, bench.workspace, out: nil) # @todo Implement gem preferences
@@ -137,6 +138,16 @@ module Solargraph
137
138
  doc_map.uncached_gemspecs || []
138
139
  end
139
140
 
141
+ # @return [::Array<Gem::Specification>]
142
+ def uncached_rbs_collection_gemspecs
143
+ @doc_map.uncached_rbs_collection_gemspecs
144
+ end
145
+
146
+ # @return [::Array<Gem::Specification>]
147
+ def uncached_yard_gemspecs
148
+ @doc_map.uncached_yard_gemspecs
149
+ end
150
+
140
151
  # @return [Enumerable<Pin::Base>]
141
152
  def core_pins
142
153
  @@core_map.pins
@@ -198,7 +209,7 @@ module Solargraph
198
209
  # @param rebuild [Boolean] whether to rebuild the pins even if they are cached
199
210
  # @return [void]
200
211
  def cache_all_for_doc_map! out: $stderr, rebuild: false
201
- doc_map.cache_doc_map_gems!(out, rebuild: rebuild)
212
+ doc_map.cache_all!(out, rebuild: rebuild)
202
213
  end
203
214
 
204
215
  # @param gemspec [Gem::Specification]
@@ -245,6 +256,12 @@ module Solargraph
245
256
  store.pins_by_class(Pin::Keyword)
246
257
  end
247
258
 
259
+ # @param name [String]
260
+ # @return [ComplexType, nil]
261
+ def unalias name
262
+ store.unalias(name)
263
+ end
264
+
248
265
  # True if the namespace exists.
249
266
  #
250
267
  # @param name [String] The namespace to match
@@ -613,7 +630,6 @@ module Solargraph
613
630
  # @param cursor [Source::Cursor]
614
631
  # @return [SourceMap::Clip]
615
632
  def clip cursor
616
- # @sg-ignore Need to add nil check here
617
633
  raise FileNotFoundError, "ApiMap did not catalog #{cursor.filename}" unless source_map_hash.key?(cursor.filename)
618
634
 
619
635
  SourceMap::Clip.new(self, cursor)
@@ -708,7 +724,7 @@ module Solargraph
708
724
  GemPins.combine_method_pins_by_path(with_resolved_aliases)
709
725
  end
710
726
 
711
- # @return [Workspace]
727
+ # @return [Workspace, nil]
712
728
  def workspace
713
729
  doc_map.workspace
714
730
  end
@@ -43,8 +43,9 @@ module Solargraph
43
43
  @rooted_tag ||= rooted_name + rooted_substring
44
44
  end
45
45
 
46
+ # Whether this is an RBS interface like _ToAry or Hash::_Key.
46
47
  def interface?
47
- name.start_with?('_')
48
+ name.start_with?('_') || name.include?('::_')
48
49
  end
49
50
 
50
51
  # @return [Boolean]
@@ -175,7 +175,6 @@ module Solargraph
175
175
  return 'NilClass' if name == 'nil'
176
176
  return 'Boolean' if %w[true false].include?(name)
177
177
  return 'Symbol' if name[0] == ':'
178
- # @sg-ignore Need to add nil check here
179
178
  return 'String' if ['"', "'"].include?(name[0])
180
179
  return 'Integer' if name.match?(/^-?\d+$/)
181
180
  name
@@ -236,9 +235,9 @@ module Solargraph
236
235
  end
237
236
  end
238
237
 
239
- # Whether this is an RBS interface like _ToAry or _Each.
238
+ # Whether this is an RBS interface like _ToAry or Hash::_Key.
240
239
  def interface?
241
- name.start_with?('_')
240
+ name.start_with?('_') || name.include?('::_')
242
241
  end
243
242
 
244
243
  # @param other [UniqueType]
@@ -385,7 +384,6 @@ module Solargraph
385
384
  def resolve_generics_from_context generics_to_resolve, context_type, resolved_generic_values: {}
386
385
  if name == ComplexType::GENERIC_TAG_NAME
387
386
  type_param = subtypes.first&.name
388
- # @sg-ignore flow sensitive typing needs to eliminate literal from union with [:bar].include?(foo)
389
387
  return self unless generics_to_resolve.include? type_param
390
388
  # @sg-ignore flow sensitive typing needs to eliminate literal from union with [:bar].include?(foo)
391
389
  unless context_type.nil? || !resolved_generic_values[type_param].nil?
@@ -38,7 +38,7 @@ module Solargraph
38
38
  types = red.items.map do |t|
39
39
  next t if %w[nil void undefined].include?(t.name)
40
40
  next t if ['::Boolean'].include?(t.rooted_name)
41
- t.qualify api_map, *gates
41
+ api_map.unalias(t.name) || t.qualify(api_map, *gates)
42
42
  end
43
43
  ComplexType.new(types).reduce_object
44
44
  end