solargraph 0.55.5 → 0.56.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e015963ad868b3671d88892483ec3c06a3e7c96757f2013ba56c514af35eb0e
4
- data.tar.gz: 22a6383d6f179ec708a930fbf8cb81bea8cbbee694de559f43208c859240a0cd
3
+ metadata.gz: ed69bea4d42d6605dab61eb153507927ac3104946f39eb1ff8380676df9d0cbc
4
+ data.tar.gz: 569b85b0c73b81135d93d814db90ffbb861a0c752515c689edaa60742d0d0f81
5
5
  SHA512:
6
- metadata.gz: cd7b151efc8a584829cdc5c4424c81dd3703dd22f8287c8edfcfc32d65b8409e8be9d8354ed5369c6fa0955cc1ccd534014f6782aa71ca7b0a89c5df8a0d9b06
7
- data.tar.gz: 818390cee111c7948e40904e1eb48dd407dd8f15045a29b96881e6bb520022438d9fca6a7ec678dbc6d793f74b3bcdaf17d4b152e86bb5b1f563f1703423a7ed
6
+ metadata.gz: 84ed3ec4cd5c58a28311964b7f201dc98c2aeaff25e383e96cf9b05a8d90a9a65552b818ee033c5a16a45d4c584069696c90299d5bc831b85985ae14f823718b
7
+ data.tar.gz: e1eb56a9f697e2cc3873ab1e60eec0608cec014d599b3ac40b832c96d3e9a90fdba4a3846127b4dc6c1270cf94344721fe0bf2d79d0db4db57cde999c418f4b2
data/CHANGELOG.md CHANGED
@@ -1,4 +1,23 @@
1
+ ## 0.56.1 - July 13, 2025
2
+ - Library avoids blocking on pending yardoc caches (#990)
3
+ - DocMap checks for default Gemfile (#989)
4
+ - [Bug fix] Fixed an error in rbs/fills/tuple.rbs (#993)
5
+
6
+ ## 0.56.0 - July 1, 2025
7
+ - [regression] Gem caching perf and logging fixes #983
8
+
1
9
  ## 0.55.5 - July 1, 2025
10
+ - Flatten results of DocMap external bundle query (#981)
11
+ - [breaking] Reimplement global conventions (#877)
12
+ - GemPins pin merging improvements (#946)
13
+ - Support class-scoped aliases and attributes from RBS (#952)
14
+ - Restructure ComplexType specs towards YARD doc compliance (#969)
15
+ - Use Prism (#974)
16
+ - Document pages (#977)
17
+ - Enable disabled-but-working specs (#978)
18
+ - Map RBS 'untyped' type (RBS::Types::Bases::Any) to 'undefined' (#979)
19
+ - Re-enable support for .gem_rbs_collection directories (#942)
20
+ - [breaking] Comply with YARD documentation on Hash tag format (#968)
2
21
  - Ignore directory paths in Workspace#would_require? (#988)
3
22
 
4
23
  ## 0.55.4 - June 27, 2025
@@ -21,8 +21,9 @@ module Solargraph
21
21
 
22
22
  # @return [Array<Gem::Specification>]
23
23
  def uncached_gemspecs
24
- (uncached_yard_gemspecs + uncached_rbs_collection_gemspecs).sort.
25
- uniq { |gemspec| "#{gemspec.name}:#{gemspec.version}" }
24
+ uncached_yard_gemspecs.concat(uncached_rbs_collection_gemspecs)
25
+ .sort
26
+ .uniq { |gemspec| "#{gemspec.name}:#{gemspec.version}" }
26
27
  end
27
28
 
28
29
  # @return [Array<Gem::Specification>]
@@ -90,9 +91,16 @@ module Solargraph
90
91
 
91
92
  # @param gemspec [Gem::Specification]
92
93
  def cache(gemspec, rebuild: false, out: nil)
93
- out.puts("Caching pins for gem #{gemspec.name}:#{gemspec.version}") if out
94
- cache_yard_pins(gemspec, out) if uncached_yard_gemspecs.include?(gemspec) || rebuild
95
- cache_rbs_collection_pins(gemspec, out) if uncached_rbs_collection_gemspecs.include?(gemspec) || rebuild
94
+ build_yard = uncached_yard_gemspecs.include?(gemspec) || rebuild
95
+ build_rbs_collection = uncached_rbs_collection_gemspecs.include?(gemspec) || rebuild
96
+ if build_yard || build_rbs_collection
97
+ type = []
98
+ type << 'YARD' if build_yard
99
+ type << 'RBS collection' if build_rbs_collection
100
+ out.puts("Caching #{type.join(' and ')} pins for gem #{gemspec.name}:#{gemspec.version}") if out
101
+ end
102
+ cache_yard_pins(gemspec, out) if build_yard
103
+ cache_rbs_collection_pins(gemspec, out) if build_rbs_collection
96
104
  end
97
105
 
98
106
  # @return [Array<Gem::Specification>]
@@ -121,10 +129,14 @@ module Solargraph
121
129
  self.class.all_rbs_collection_gems_in_memory[rbs_collection_path] ||= {}
122
130
  end
123
131
 
124
- def combined_pins_in_memory
132
+ def self.all_combined_pins_in_memory
125
133
  @combined_pins_in_memory ||= {}
126
134
  end
127
135
 
136
+ def combined_pins_in_memory
137
+ self.class.all_combined_pins_in_memory
138
+ end
139
+
128
140
  # @return [Set<Gem::Specification>]
129
141
  def dependencies
130
142
  @dependencies ||= (gemspecs.flat_map { |spec| fetch_dependencies(spec) } - gemspecs).to_set
@@ -344,7 +356,10 @@ module Solargraph
344
356
  end
345
357
 
346
358
  def gemspecs_required_from_bundler
347
- if workspace&.directory && Bundler.definition&.lockfile&.to_s&.start_with?(workspace.directory)
359
+ # @todo Handle projects with custom Bundler/Gemfile setups
360
+ return unless workspace.gemfile?
361
+
362
+ if workspace.gemfile? && Bundler.definition&.lockfile&.to_s&.start_with?(workspace.directory)
348
363
  # Find only the gems bundler is now using
349
364
  Bundler.definition.locked_gems.specs.flat_map do |lazy_spec|
350
365
  logger.info "Handling #{lazy_spec.name}:#{lazy_spec.version}"
@@ -385,8 +400,7 @@ module Solargraph
385
400
  next specs
386
401
  end.compact
387
402
  else
388
- Solargraph.logger.warn e
389
- raise BundleNotFoundError, "Failed to load gems from bundle at #{workspace&.directory}"
403
+ Solargraph.logger.warn "Failed to load gems from bundle at #{workspace&.directory}: #{e}"
390
404
  end
391
405
  end
392
406
  end
@@ -587,30 +587,54 @@ module Solargraph
587
587
 
588
588
  # @return [void]
589
589
  def cache_next_gemspec
590
- return if @cache_progres
591
- spec = (api_map.uncached_yard_gemspecs + api_map.uncached_rbs_collection_gemspecs).
592
- find { |spec| !cache_errors.include?(spec) }
590
+ return if @cache_progress
591
+
592
+ spec = cacheable_specs.first
593
593
  return end_cache_progress unless spec
594
594
 
595
595
  pending = api_map.uncached_gemspecs.length - cache_errors.length - 1
596
- logger.info "Caching #{spec.name} #{spec.version}"
597
- Thread.new do
598
- cache_pid = Process.spawn(workspace.command_path, 'cache', spec.name, spec.version.to_s)
599
- report_cache_progress spec.name, pending
600
- Process.wait(cache_pid)
601
- logger.info "Cached #{spec.name} #{spec.version}"
602
- rescue Errno::EINVAL => _e
603
- logger.info "Cached #{spec.name} #{spec.version} with EINVAL"
604
- rescue StandardError => e
605
- cache_errors.add spec
606
- Solargraph.logger.warn "Error caching gemspec #{spec.name} #{spec.version}: [#{e.class}] #{e.message}"
607
- ensure
608
- end_cache_progress
596
+
597
+ if Yardoc.processing?(spec)
598
+ logger.info "Enqueuing cache of #{spec.name} #{spec.version} (already being processed)"
599
+ queued_gemspec_cache.push(spec)
600
+ return if pending - queued_gemspec_cache.length < 1
601
+
609
602
  catalog
610
603
  sync_catalog
604
+ else
605
+ logger.info "Caching #{spec.name} #{spec.version}"
606
+ Thread.new do
607
+ cache_pid = Process.spawn(workspace.command_path, 'cache', spec.name, spec.version.to_s)
608
+ report_cache_progress spec.name, pending
609
+ Process.wait(cache_pid)
610
+ logger.info "Cached #{spec.name} #{spec.version}"
611
+ rescue Errno::EINVAL => _e
612
+ logger.info "Cached #{spec.name} #{spec.version} with EINVAL"
613
+ rescue StandardError => e
614
+ cache_errors.add spec
615
+ Solargraph.logger.warn "Error caching gemspec #{spec.name} #{spec.version}: [#{e.class}] #{e.message}"
616
+ ensure
617
+ end_cache_progress
618
+ catalog
619
+ sync_catalog
620
+ end
611
621
  end
612
622
  end
613
623
 
624
+ def cacheable_specs
625
+ cacheable = api_map.uncached_yard_gemspecs +
626
+ api_map.uncached_rbs_collection_gemspecs -
627
+ queued_gemspec_cache -
628
+ cache_errors.to_a
629
+ return cacheable unless cacheable.empty?
630
+
631
+ queued_gemspec_cache
632
+ end
633
+
634
+ def queued_gemspec_cache
635
+ @queued_gemspec_cache ||= []
636
+ end
637
+
614
638
  # @param gem_name [String]
615
639
  # @param pending [Integer]
616
640
  # @return [void]
@@ -137,15 +137,18 @@ module Solargraph
137
137
  # @param names [Array<String>]
138
138
  # @return [void]
139
139
  def gems *names
140
+ api_map = ApiMap.load('.')
140
141
  if names.empty?
141
- Gem::Specification.to_a.each { |spec| do_cache spec }
142
+ Gem::Specification.to_a.each { |spec| do_cache spec, api_map }
143
+ STDERR.puts "Documentation cached for all #{Gem::Specification.count} gems."
142
144
  else
143
145
  names.each do |name|
144
146
  spec = Gem::Specification.find_by_name(*name.split('='))
145
- do_cache spec
147
+ do_cache spec, api_map
146
148
  rescue Gem::MissingSpecError
147
149
  warn "Gem '#{name}' not found"
148
150
  end
151
+ STDERR.puts "Documentation cached for #{names.count} gems."
149
152
  end
150
153
  end
151
154
 
@@ -256,8 +259,7 @@ module Solargraph
256
259
 
257
260
  # @param gemspec [Gem::Specification]
258
261
  # @return [void]
259
- def do_cache gemspec
260
- api_map = ApiMap.load('.')
262
+ def do_cache gemspec, api_map
261
263
  # @todo if the rebuild: option is passed as a positional arg,
262
264
  # typecheck doesn't complain on the below line
263
265
  api_map.cache_gem(gemspec, rebuild: options.rebuild, out: $stdout)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.55.5'
4
+ VERSION = '0.56.1'
5
5
  end
@@ -155,6 +155,14 @@ module Solargraph
155
155
  server['commandPath'] || 'solargraph'
156
156
  end
157
157
 
158
+ # True if the workspace has a root Gemfile.
159
+ #
160
+ # @todo Handle projects with custom Bundler/Gemfile setups (see DocMap#gemspecs_required_from_bundler)
161
+ #
162
+ def gemfile?
163
+ directory && File.file?(File.join(directory, 'Gemfile'))
164
+ end
165
+
158
166
  private
159
167
 
160
168
  # The language server configuration (or an empty hash if the workspace was
@@ -30,6 +30,13 @@ module Solargraph
30
30
  File.exist?(yardoc)
31
31
  end
32
32
 
33
+ # True if another process is currently building the yardoc cache.
34
+ #
35
+ def processing?(gemspec)
36
+ yardoc = File.join(PinCache.yardoc_path(gemspec), 'processing')
37
+ File.exist?(yardoc)
38
+ end
39
+
33
40
  # Load a gem's yardoc and return its code objects.
34
41
  #
35
42
  # @note This method modifies the global YARD registry.
data/solargraph.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.add_runtime_dependency 'ostruct', '~> 0.6'
36
36
  s.add_runtime_dependency 'parser', '~> 3.0'
37
37
  s.add_runtime_dependency 'prism', '~> 1.4'
38
- s.add_runtime_dependency 'rbs', '~> 3.3'
38
+ s.add_runtime_dependency 'rbs', '~> 3.6.1'
39
39
  s.add_runtime_dependency 'reverse_markdown', '~> 3.0'
40
40
  s.add_runtime_dependency 'rubocop', '~> 1.38'
41
41
  s.add_runtime_dependency 'thor', '~> 1.0'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.5
4
+ version: 0.56.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-01 00:00:00.000000000 Z
10
+ date: 2025-07-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: backport
@@ -189,14 +189,14 @@ dependencies:
189
189
  requirements:
190
190
  - - "~>"
191
191
  - !ruby/object:Gem::Version
192
- version: '3.3'
192
+ version: 3.6.1
193
193
  type: :runtime
194
194
  prerelease: false
195
195
  version_requirements: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '3.3'
199
+ version: 3.6.1
200
200
  - !ruby/object:Gem::Dependency
201
201
  name: reverse_markdown
202
202
  requirement: !ruby/object:Gem::Requirement