solargraph 0.55.4 → 0.56.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/plugins.yml +2 -0
  3. data/.github/workflows/typecheck.yml +2 -0
  4. data/.gitignore +2 -0
  5. data/CHANGELOG.md +17 -0
  6. data/README.md +13 -3
  7. data/lib/solargraph/api_map/index.rb +23 -15
  8. data/lib/solargraph/api_map/store.rb +2 -1
  9. data/lib/solargraph/api_map.rb +53 -27
  10. data/lib/solargraph/complex_type/type_methods.rb +5 -1
  11. data/lib/solargraph/complex_type/unique_type.rb +7 -0
  12. data/lib/solargraph/convention/base.rb +3 -3
  13. data/lib/solargraph/convention.rb +3 -3
  14. data/lib/solargraph/doc_map.rb +200 -43
  15. data/lib/solargraph/gem_pins.rb +53 -38
  16. data/lib/solargraph/language_server/host.rb +9 -1
  17. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +1 -0
  18. data/lib/solargraph/language_server/message/extended/document.rb +5 -2
  19. data/lib/solargraph/language_server/message/extended/document_gems.rb +3 -3
  20. data/lib/solargraph/library.rb +6 -3
  21. data/lib/solargraph/location.rb +13 -0
  22. data/lib/solargraph/parser/parser_gem/class_methods.rb +5 -8
  23. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -2
  24. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +2 -2
  25. data/lib/solargraph/pin/base.rb +268 -24
  26. data/lib/solargraph/pin/base_variable.rb +9 -8
  27. data/lib/solargraph/pin/callable.rb +69 -0
  28. data/lib/solargraph/pin/closure.rb +12 -0
  29. data/lib/solargraph/pin/local_variable.rb +8 -5
  30. data/lib/solargraph/pin/method.rb +134 -17
  31. data/lib/solargraph/pin/parameter.rb +43 -6
  32. data/lib/solargraph/pin/signature.rb +38 -0
  33. data/lib/solargraph/pin_cache.rb +185 -0
  34. data/lib/solargraph/position.rb +9 -0
  35. data/lib/solargraph/range.rb +9 -0
  36. data/lib/solargraph/rbs_map/conversions.rb +19 -8
  37. data/lib/solargraph/rbs_map/core_map.rb +31 -9
  38. data/lib/solargraph/rbs_map/stdlib_map.rb +15 -5
  39. data/lib/solargraph/rbs_map.rb +74 -17
  40. data/lib/solargraph/shell.rb +16 -18
  41. data/lib/solargraph/source_map.rb +0 -17
  42. data/lib/solargraph/version.rb +1 -1
  43. data/lib/solargraph/views/_method.erb +10 -10
  44. data/lib/solargraph/views/_namespace.erb +3 -3
  45. data/lib/solargraph/views/document.erb +10 -10
  46. data/lib/solargraph/workspace.rb +15 -5
  47. data/lib/solargraph/yardoc.rb +6 -9
  48. data/lib/solargraph.rb +10 -12
  49. data/rbs_collection.yaml +19 -0
  50. data/solargraph.gemspec +1 -0
  51. metadata +19 -7
  52. data/lib/solargraph/cache.rb +0 -77
@@ -7,19 +7,29 @@ module Solargraph
7
7
  # Ruby stdlib pins
8
8
  #
9
9
  class StdlibMap < RbsMap
10
+ include Logging
11
+
10
12
  # @type [Hash{String => RbsMap}]
11
13
  @stdlib_maps_hash = {}
12
14
 
13
15
  # @param library [String]
14
16
  def initialize library
15
- cache = Cache.load('stdlib', "#{library}.ser")
16
- if cache
17
- pins.replace cache
17
+ cached_pins = PinCache.deserialize_stdlib_require library
18
+ if cached_pins
19
+ @pins = cached_pins
18
20
  @resolved = true
21
+ @loaded = true
22
+ logger.debug { "Deserialized #{cached_pins.length} cached pins for stdlib require #{library.inspect}" }
19
23
  else
20
24
  super
21
- return unless resolved?
22
- Cache.save('stdlib', "#{library}.ser", pins)
25
+ unless resolved?
26
+ @pins = []
27
+ logger.info { "Could not resolve #{library.inspect}" }
28
+ return
29
+ end
30
+ generated_pins = pins
31
+ logger.debug { "Found #{generated_pins.length} pins for stdlib library #{library}" }
32
+ PinCache.serialize_stdlib_require library, generated_pins
23
33
  end
24
34
  end
25
35
 
@@ -10,25 +10,78 @@ module Solargraph
10
10
  autoload :CoreFills, 'solargraph/rbs_map/core_fills'
11
11
  autoload :StdlibMap, 'solargraph/rbs_map/stdlib_map'
12
12
 
13
- include Conversions
13
+ include Logging
14
14
 
15
15
  # @type [Hash{String => RbsMap}]
16
16
  @@rbs_maps_hash = {}
17
17
 
18
18
  attr_reader :library
19
19
 
20
+ attr_reader :rbs_collection_paths
21
+
22
+ attr_reader :rbs_collection_config_path
23
+
20
24
  # @param library [String]
21
25
  # @param version [String, nil]
22
- # @param directories [Array<Pathname, String>]
23
- def initialize library, version = nil, directories: []
26
+ # @param rbs_collection_paths [Array<Pathname, String>]
27
+ def initialize library, version = nil, rbs_collection_config_path: nil, rbs_collection_paths: []
28
+ if rbs_collection_config_path.nil? && !rbs_collection_paths.empty?
29
+ raise 'Please provide rbs_collection_config_path if you provide rbs_collection_paths'
30
+ end
24
31
  @library = library
25
32
  @version = version
26
- @collection = nil
27
- @directories = directories
28
- loader = RBS::EnvironmentLoader.new(core_root: nil, repository: repository)
33
+ @rbs_collection_config_path = rbs_collection_config_path
34
+ @rbs_collection_paths = rbs_collection_paths
29
35
  add_library loader, library, version
30
- return unless resolved?
31
- load_environment_to_pins(loader)
36
+ end
37
+
38
+ def loader
39
+ @loader ||= RBS::EnvironmentLoader.new(core_root: nil, repository: repository)
40
+ end
41
+
42
+ # @return string representing the version of the RBS info fetched
43
+ # for the given library. Must change when the RBS info is
44
+ # updated upstream for the same library and version. May change
45
+ # if the config for where information comes form changes.
46
+ def cache_key
47
+ @hextdigest ||= begin
48
+ data = nil
49
+ if rbs_collection_config_path
50
+ lockfile_path = RBS::Collection::Config.to_lockfile_path(Pathname.new(rbs_collection_config_path))
51
+ if lockfile_path.exist?
52
+ collection_config = RBS::Collection::Config.from_path lockfile_path
53
+ gem_config = collection_config.gem(library)
54
+ data = gem_config&.to_s
55
+ end
56
+ end
57
+ if data.nil? || data.empty?
58
+ if resolved?
59
+ # definitely came from the gem itself and not elsewhere -
60
+ # only one version per gem
61
+ 'gem-export'
62
+ else
63
+ 'unresolved'
64
+ end
65
+ else
66
+ Digest::SHA1.hexdigest(data)
67
+ end
68
+ end
69
+ end
70
+
71
+ def self.from_gemspec gemspec, rbs_collection_path, rbs_collection_config_path
72
+ rbs_map = RbsMap.new(gemspec.name, gemspec.version,
73
+ rbs_collection_paths: [rbs_collection_path].compact,
74
+ rbs_collection_config_path: rbs_collection_config_path)
75
+ return rbs_map if rbs_map.resolved?
76
+
77
+ # try any version of the gem in the collection
78
+ RbsMap.new(gemspec.name, nil,
79
+ rbs_collection_paths: [rbs_collection_path].compact,
80
+ rbs_collection_config_path: rbs_collection_config_path)
81
+ end
82
+
83
+ def pins
84
+ @pins ||= resolved? ? conversions.pins : []
32
85
  end
33
86
 
34
87
  # @generic T
@@ -52,9 +105,10 @@ module Solargraph
52
105
 
53
106
  def repository
54
107
  @repository ||= RBS::Repository.new(no_stdlib: false).tap do |repo|
55
- # @todo Temporarily ignoring external directories due to issues with
56
- # incomplete/broken gem_rbs_collection installations
57
- # @directories.each { |dir| repo.add(Pathname.new(dir)) }
108
+ @rbs_collection_paths.each do |dir|
109
+ dir_path = Pathname.new(dir)
110
+ repo.add(dir_path) if dir_path.exist? && dir_path.directory?
111
+ end
58
112
  end
59
113
  end
60
114
 
@@ -64,12 +118,15 @@ module Solargraph
64
118
  @@rbs_maps_hash[library] ||= RbsMap.new(library)
65
119
  end
66
120
 
67
- # @param gemspec [Gem::Specification]
68
- def self.from_gemspec(gemspec)
69
- RbsMap.new(gemspec.name, gemspec.version)
121
+ private
122
+
123
+ def loader
124
+ @loader ||= RBS::EnvironmentLoader.new(core_root: nil, repository: repository)
70
125
  end
71
126
 
72
- private
127
+ def conversions
128
+ @conversions ||= Conversions.new(loader: loader)
129
+ end
73
130
 
74
131
  # @param loader [RBS::EnvironmentLoader]
75
132
  # @param library [String]
@@ -77,10 +134,10 @@ module Solargraph
77
134
  def add_library loader, library, version
78
135
  @resolved = if loader.has_library?(library: library, version: version)
79
136
  loader.add library: library, version: version
80
- Solargraph.logger.info "#{short_name} successfully loaded library #{library}"
137
+ logger.debug { "#{short_name} successfully loaded library #{library}:#{version}" }
81
138
  true
82
139
  else
83
- Solargraph.logger.info "#{short_name} failed to load library #{library}"
140
+ logger.info { "#{short_name} did not find data for library #{library}:#{version}" }
84
141
  false
85
142
  end
86
143
  end
@@ -90,19 +90,20 @@ module Solargraph
90
90
  # @return [void]
91
91
  def clear
92
92
  puts "Deleting all cached documentation (gems, core and stdlib)"
93
- Solargraph::Cache.clear
93
+ Solargraph::PinCache.clear
94
94
  end
95
95
  map 'clear-cache' => :clear
96
96
  map 'clear-cores' => :clear
97
97
 
98
98
  desc 'cache', 'Cache a gem', hide: true
99
+ option :rebuild, type: :boolean, desc: 'Rebuild existing documentation', default: false
99
100
  # @return [void]
100
101
  # @param gem [String]
101
102
  # @param version [String, nil]
102
103
  def cache gem, version = nil
104
+ api_map = Solargraph::ApiMap.load(Dir.pwd)
103
105
  spec = Gem::Specification.find_by_name(gem, version)
104
- pins = GemPins.build(spec)
105
- Cache.save('gems', "#{spec.name}-#{spec.version}.ser", pins)
106
+ api_map.cache_gem(spec, rebuild: options[:rebuild], out: $stdout)
106
107
  end
107
108
 
108
109
  desc 'uncache GEM [...GEM]', "Delete specific cached gem documentation"
@@ -117,18 +118,17 @@ module Solargraph
117
118
  raise ArgumentError, 'No gems specified.' if gems.empty?
118
119
  gems.each do |gem|
119
120
  if gem == 'core'
120
- Cache.uncache("core.ser")
121
+ PinCache.uncache_core
121
122
  next
122
123
  end
123
124
 
124
125
  if gem == 'stdlib'
125
- Cache.uncache("stdlib")
126
+ PinCache.uncache_stdlib
126
127
  next
127
128
  end
128
129
 
129
130
  spec = Gem::Specification.find_by_name(gem)
130
- Cache.uncache('gems', "#{spec.name}-#{spec.version}.ser")
131
- Cache.uncache('gems', "#{spec.name}-#{spec.version}.yardoc")
131
+ PinCache.uncache_gem(spec, out: $stdout)
132
132
  end
133
133
  end
134
134
 
@@ -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,15 +259,10 @@ module Solargraph
256
259
 
257
260
  # @param gemspec [Gem::Specification]
258
261
  # @return [void]
259
- def do_cache gemspec
260
- cached = Yardoc.cached?(gemspec)
261
- if cached && !options.rebuild
262
- puts "Cache already exists for #{gemspec.name} #{gemspec.version}"
263
- else
264
- puts "#{cached ? 'Rebuilding' : 'Caching'} gem documentation for #{gemspec.name} #{gemspec.version}"
265
- pins = GemPins.build(gemspec)
266
- Cache.save('gems', "#{gemspec.name}-#{gemspec.version}.ser", pins)
267
- end
262
+ def do_cache gemspec, api_map
263
+ # @todo if the rebuild: option is passed as a positional arg,
264
+ # typecheck doesn't complain on the below line
265
+ api_map.cache_gem(gemspec, rebuild: options.rebuild, out: $stdout)
268
266
  end
269
267
  end
270
268
  end
@@ -118,23 +118,6 @@ module Solargraph
118
118
  _locate_pin line, character, Pin::Namespace, Pin::Method, Pin::Block
119
119
  end
120
120
 
121
- # @todo Candidate for deprecation
122
- #
123
- # @param other_map [SourceMap]
124
- # @return [Boolean]
125
- def try_merge! other_map
126
- return false if pins.length != other_map.pins.length || locals.length != other_map.locals.length || requires.map(&:name).uniq.sort != other_map.requires.map(&:name).uniq.sort
127
-
128
- pins.each_index do |i|
129
- return false unless pins[i].try_merge!(other_map.pins[i])
130
- end
131
- locals.each_index do |i|
132
- return false unless locals[i].try_merge!(other_map.locals[i])
133
- end
134
- @source = other_map.source
135
- true
136
- end
137
-
138
121
  # @param name [String]
139
122
  # @return [Array<Location>]
140
123
  def references name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.55.4'
4
+ VERSION = '0.56.0'
5
5
  end
@@ -2,33 +2,33 @@
2
2
  Namespace:
3
3
  </h2>
4
4
  <p>
5
- <a href="solargraph:/document?query=<%= CGI.escape object.namespace.path %>"><%= object.namespace %></a>
5
+ <a href="solargraph:/document?query=<%= CGI.escape pin.namespace.path %>"><%= pin.namespace %></a>
6
6
  </p>
7
7
  <h2>
8
8
  Overview:
9
9
  </h2>
10
- <%= htmlify object.docstring %>
10
+ <%= htmlify pin.docstring %>
11
11
  <p class="document-section">
12
- <big><strong>Visibility:</strong></big> <%= object.visibility %>
12
+ <big><strong>Visibility:</strong></big> <%= pin.visibility %>
13
13
  </p>
14
- <% unless object.tags(:param).empty? %>
14
+ <% unless pin.docstring.tags(:param).empty? %>
15
15
  <h2>
16
16
  Parameters:
17
17
  </h2>
18
18
  <ul>
19
- <% object.tags(:param).each do |tag| %>
19
+ <% pin.docstring.tags(:param).each do |tag| %>
20
20
  <li>
21
21
  <%= erb :_name_type_tag, layout: false, locals: {tag: tag} %>
22
22
  </li>
23
23
  <% end %>
24
24
  </ul>
25
25
  <% end %>
26
- <% unless object.tags(:raise).empty? %>
26
+ <% unless pin.docstring.tags(:raise).empty? %>
27
27
  <h2>
28
28
  Raises:
29
29
  </h2>
30
30
  <ul>
31
- <% object.tags(:raise).each do |tag| %>
31
+ <% pin.docstring.tags(:raise).each do |tag| %>
32
32
  <li>
33
33
  <%= erb :_name_type_tag, layout: false, locals: {tag: tag} %>
34
34
  </li>
@@ -38,20 +38,20 @@
38
38
  <h2>
39
39
  Returns:
40
40
  </h2>
41
- <% if object.tag(:return).nil? %>
41
+ <% if pin.docstring.tag(:return).nil? %>
42
42
  <p>
43
43
  Undefined/unknown
44
44
  </p>
45
45
  <% else %>
46
46
  <ul>
47
- <% object.tags(:return).each do |tag| %>
47
+ <% pin.tags(:return).each do |tag| %>
48
48
  <li>
49
49
  <%= erb :_name_type_tag, layout: false, locals: {tag: tag} %>
50
50
  </li>
51
51
  <% end %>
52
52
  </ul>
53
53
  <% end %>
54
- <% examples = object.tags(:example) %>
54
+ <% examples = pin.docstring.tags(:example) %>
55
55
  <% unless examples.nil? %>
56
56
  <% examples.each do |example| %>
57
57
  <h2>
@@ -1,12 +1,12 @@
1
1
  <h2>
2
2
  Overview:
3
3
  </h2>
4
- <%= htmlify object.docstring %>
4
+ <%= htmlify pin.docstring %>
5
5
  <h2>
6
6
  Class Methods
7
7
  </h2>
8
8
  <ul class="doc-list">
9
- <% object.meths(scope: :class).sort{|a, b| a.name <=> b.name}.each do |meth| %>
9
+ <% api_map.get_methods(pin.path, scope: :class, deep: false).sort{|a, b| a.name <=> b.name}.each do |meth| %>
10
10
  <li>
11
11
  <a href="solargraph:/document?query=<%= CGI.escape(meth.path) %>"><%= meth.name %></a>
12
12
  </li>
@@ -16,7 +16,7 @@
16
16
  Instance Methods
17
17
  </h2>
18
18
  <ul class="doc-list">
19
- <% object.meths(scope: :instance).sort{|a, b| a.name <=> b.name}.each do |meth| %>
19
+ <% api_map.get_methods(pin.path, scope: :instance, deep: false).sort{|a, b| a.name <=> b.name}.each do |meth| %>
20
20
  <li>
21
21
  <a href="solargraph:/document?query=<%= CGI.escape(meth.path) %>"><%= meth.name %></a>
22
22
  </li>
@@ -1,23 +1,23 @@
1
- <% objects.reverse.each do |object| %>
1
+ <% pins.each do |pin| %>
2
2
  <h1>
3
- <%= object.name %>
4
- <% if object.is_a?(YARD::CodeObjects::MethodObject) and !object.parameters.empty? %>
5
- <small>(<%= object.parameters.map {|p| "#{p[0]}#{p[1] and p[0].end_with?(':') ? ' ' : (p[1] ? ' = ' : '')}#{p[1]}"}.join(', ') %>)</small>
3
+ <%= pin.name %>
4
+ <% if pin.is_a?(Solargraph::Pin::Method) && !pin.parameters.empty? %>
5
+ <small>(<%= pin.parameters.map {|p| "#{p[0]}#{p[1] and p[0].end_with?(':') ? ' ' : (p[1] ? ' = ' : '')}#{p[1]}"}.join(', ') %>)</small>
6
6
  <% end %>
7
7
  </h1>
8
- <% unless object.files.empty? %>
8
+ <% unless pins.map(&:location).compact.empty? %>
9
9
  <h2>
10
10
  Defined in:
11
11
  </h2>
12
12
  <ul>
13
- <% object.files.each do |f| %>
13
+ <% pins.map(&:location).compact.map(&:filename).each do |f| %>
14
14
  <li><%= f %></li>
15
15
  <% end %>
16
16
  </ul>
17
17
  <% end %>
18
- <% if object.is_a?(YARD::CodeObjects::NamespaceObject) %>
19
- <%= erb :_namespace, layout: false, locals: {object: object} %>
20
- <% elsif object.is_a?(YARD::CodeObjects::MethodObject) %>
21
- <%= erb :_method, layout: false, locals: {object: object} %>
18
+ <% if pin.is_a?(Solargraph::Pin::Namespace) %>
19
+ <%= erb :_namespace, layout: false, locals: {api_map: api_map, pin: pin} %>
20
+ <% elsif pin.is_a?(Solargraph::Pin::Method) %>
21
+ <%= erb :_method, layout: false, locals: {api_map: api_map, pin: pin} %>
22
22
  <% end %>
23
23
  <% end %>
@@ -106,7 +106,7 @@ module Solargraph
106
106
  def would_require? path
107
107
  require_paths.each do |rp|
108
108
  full = File.join rp, path
109
- return true if File.exist?(full) or File.exist?(full << ".rb")
109
+ return true if File.file?(full) || File.file?(full << ".rb")
110
110
  end
111
111
  false
112
112
  end
@@ -133,6 +133,15 @@ module Solargraph
133
133
  @gem_rbs_collection ||= read_rbs_collection_path
134
134
  end
135
135
 
136
+ def rbs_collection_config_path
137
+ @rbs_collection_config_path ||= begin
138
+ unless directory.empty? || directory == '*'
139
+ yaml_file = File.join(directory, 'rbs_collection.yaml')
140
+ yaml_file if File.file?(yaml_file)
141
+ end
142
+ end
143
+ end
144
+
136
145
  # Synchronize the workspace from the provided updater.
137
146
  #
138
147
  # @param updater [Source::Updater]
@@ -214,7 +223,7 @@ module Solargraph
214
223
  def configured_require_paths
215
224
  return ['lib'] if directory.empty?
216
225
  return [File.join(directory, 'lib')] if config.require_paths.empty?
217
- config.require_paths.map{|p| File.join(directory, p)}
226
+ config.require_paths.map { |p| File.join(directory, p) }
218
227
  end
219
228
 
220
229
  # @return [void]
@@ -230,10 +239,11 @@ module Solargraph
230
239
 
231
240
  # @return [String, nil]
232
241
  def read_rbs_collection_path
233
- yaml_file = File.join(directory, 'rbs_collection.yaml')
234
- return unless File.file?(yaml_file)
242
+ return unless rbs_collection_config_path
235
243
 
236
- YAML.load_file(yaml_file)&.fetch('path')
244
+ path = YAML.load_file(rbs_collection_config_path)&.fetch('path')
245
+ # make fully qualified
246
+ File.expand_path(path, directory)
237
247
  end
238
248
  end
239
249
  end
@@ -12,7 +12,7 @@ module Solargraph
12
12
  # @param gemspec [Gem::Specification]
13
13
  # @return [String] The path to the cached yardoc.
14
14
  def cache(gemspec)
15
- path = path_for(gemspec)
15
+ path = PinCache.yardoc_path gemspec
16
16
  return path if cached?(gemspec)
17
17
 
18
18
  Solargraph.logger.info "Caching yardoc for #{gemspec.name} #{gemspec.version}"
@@ -26,16 +26,13 @@ module Solargraph
26
26
  #
27
27
  # @param gemspec [Gem::Specification]
28
28
  def cached?(gemspec)
29
- yardoc = File.join(path_for(gemspec), 'complete')
29
+ yardoc = File.join(PinCache.yardoc_path(gemspec), 'complete')
30
30
  File.exist?(yardoc)
31
31
  end
32
32
 
33
- # Get the absolute path for a cached gem yardoc.
34
- #
35
- # @param gemspec [Gem::Specification]
36
- # @return [String]
37
- def path_for(gemspec)
38
- File.join(Solargraph::Cache.base_dir, "yard-#{YARD::VERSION}", "#{gemspec.name}-#{gemspec.version}.yardoc")
33
+ def processing?(gemspec)
34
+ yardoc = File.join(PinCache.yardoc_path(gemspec), 'processing')
35
+ File.exist?(yardoc)
39
36
  end
40
37
 
41
38
  # Load a gem's yardoc and return its code objects.
@@ -45,7 +42,7 @@ module Solargraph
45
42
  # @param gemspec [Gem::Specification]
46
43
  # @return [Array<YARD::CodeObjects::Base>]
47
44
  def load!(gemspec)
48
- YARD::Registry.load! path_for(gemspec)
45
+ YARD::Registry.load! PinCache.yardoc_path gemspec
49
46
  YARD::Registry.all
50
47
  end
51
48
  end
data/lib/solargraph.rb CHANGED
@@ -48,23 +48,21 @@ module Solargraph
48
48
  autoload :Parser, 'solargraph/parser'
49
49
  autoload :RbsMap, 'solargraph/rbs_map'
50
50
  autoload :GemPins, 'solargraph/gem_pins'
51
- autoload :Cache, 'solargraph/cache'
51
+ autoload :PinCache, 'solargraph/pin_cache'
52
52
 
53
53
  dir = File.dirname(__FILE__)
54
54
  VIEWS_PATH = File.join(dir, 'solargraph', 'views')
55
55
 
56
- # @param type [Symbol] Type of assert. Not used yet, but may be
57
- # used in the future to allow configurable asserts mixes for
58
- # different situations.
56
+ # @param type [Symbol] Type of assert.
59
57
  def self.asserts_on?(type)
60
- @asserts_on ||= if ENV['SOLARGRAPH_ASSERTS'].nil? || ENV['SOLARGRAPH_ASSERTS'].empty?
61
- false
62
- elsif ENV['SOLARGRAPH_ASSERTS'] == 'on'
63
- true
64
- else
65
- logger.warn "Unrecognized SOLARGRAPH_ASSERTS value: #{ENV['SOLARGRAPH_ASSERTS']}"
66
- false
67
- end
58
+ if ENV['SOLARGRAPH_ASSERTS'].nil? || ENV['SOLARGRAPH_ASSERTS'].empty?
59
+ false
60
+ elsif ENV['SOLARGRAPH_ASSERTS'] == 'on'
61
+ true
62
+ else
63
+ logger.warn "Unrecognized SOLARGRAPH_ASSERTS value: #{ENV['SOLARGRAPH_ASSERTS']}"
64
+ false
65
+ end
68
66
  end
69
67
 
70
68
  def self.assert_or_log(type, msg = nil, &block)
@@ -0,0 +1,19 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ # gems:
17
+ # # If you want to avoid installing rbs files for gems, you can specify them here.
18
+ # - name: GEM_NAME
19
+ # ignore: true
data/solargraph.gemspec CHANGED
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.add_runtime_dependency 'observer', '~> 0.1'
35
35
  s.add_runtime_dependency 'ostruct', '~> 0.6'
36
36
  s.add_runtime_dependency 'parser', '~> 3.0'
37
+ s.add_runtime_dependency 'prism', '~> 1.4'
37
38
  s.add_runtime_dependency 'rbs', '~> 3.3'
38
39
  s.add_runtime_dependency 'reverse_markdown', '~> 3.0'
39
40
  s.add_runtime_dependency 'rubocop', '~> 1.38'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.4
4
+ version: 0.56.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-06-27 00:00:00.000000000 Z
10
+ date: 2025-07-01 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: backport
@@ -170,6 +169,20 @@ dependencies:
170
169
  - - "~>"
171
170
  - !ruby/object:Gem::Version
172
171
  version: '3.0'
172
+ - !ruby/object:Gem::Dependency
173
+ name: prism
174
+ requirement: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '1.4'
179
+ type: :runtime
180
+ prerelease: false
181
+ version_requirements: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: '1.4'
173
186
  - !ruby/object:Gem::Dependency
174
187
  name: rbs
175
188
  requirement: !ruby/object:Gem::Requirement
@@ -401,7 +414,6 @@ files:
401
414
  - lib/solargraph/api_map/source_to_yard.rb
402
415
  - lib/solargraph/api_map/store.rb
403
416
  - lib/solargraph/bench.rb
404
- - lib/solargraph/cache.rb
405
417
  - lib/solargraph/complex_type.rb
406
418
  - lib/solargraph/complex_type/type_methods.rb
407
419
  - lib/solargraph/complex_type/unique_type.rb
@@ -568,6 +580,7 @@ files:
568
580
  - lib/solargraph/pin/symbol.rb
569
581
  - lib/solargraph/pin/until.rb
570
582
  - lib/solargraph/pin/while.rb
583
+ - lib/solargraph/pin_cache.rb
571
584
  - lib/solargraph/position.rb
572
585
  - lib/solargraph/range.rb
573
586
  - lib/solargraph/rbs_map.rb
@@ -632,6 +645,7 @@ files:
632
645
  - lib/solargraph/yard_tags.rb
633
646
  - lib/solargraph/yardoc.rb
634
647
  - rbs/fills/tuple.rbs
648
+ - rbs_collection.yaml
635
649
  - solargraph.gemspec
636
650
  homepage: https://solargraph.org
637
651
  licenses:
@@ -641,7 +655,6 @@ metadata:
641
655
  bug_tracker_uri: https://github.com/castwide/solargraph/issues
642
656
  changelog_uri: https://github.com/castwide/solargraph/blob/master/CHANGELOG.md
643
657
  source_code_uri: https://github.com/castwide/solargraph
644
- post_install_message:
645
658
  rdoc_options: []
646
659
  require_paths:
647
660
  - lib
@@ -656,8 +669,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
656
669
  - !ruby/object:Gem::Version
657
670
  version: '0'
658
671
  requirements: []
659
- rubygems_version: 3.5.22
660
- signing_key:
672
+ rubygems_version: 3.6.7
661
673
  specification_version: 4
662
674
  summary: A Ruby language server
663
675
  test_files: []