Skip to content

Commit

Permalink
Merge pull request #43 from ruby/follow_rbs_collection_yaml
Browse files Browse the repository at this point in the history
Don't load gem's rbs if rbs_collection.yaml exists
  • Loading branch information
ima1zumi authored Dec 12, 2024
2 parents 237ebf2 + 358b89b commit cbb2cfb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/repl_type_completor/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ def self.load_rbs_builder
sig_path = Pathname('sig')
loader.add path: sig_path
expanded_sig_path = sig_path.expand_path.to_s
Gem.loaded_specs.values.each do |spec|
gem_sig_path = File.expand_path("#{spec.gem_dir}/sig")
loader.add(library: spec.name, version: spec.version) if Dir.exist?(gem_sig_path) && expanded_sig_path != gem_sig_path

unless File.exist?('rbs_collection.yaml')
# Load rbs signature from gems. This is a fallback when rbs_collection.yaml is not available.
Gem.loaded_specs.values.each do |spec|
gem_sig_path = File.expand_path("#{spec.gem_dir}/sig")
loader.add(library: spec.name, version: spec.version) if Dir.exist?(gem_sig_path) && expanded_sig_path != gem_sig_path
end
end

env = RBS::Environment.from_loader(loader)
# [Hack] Monkey patch for improving development experience
def env.resolve_declaration(*, **)
Expand Down

0 comments on commit cbb2cfb

Please sign in to comment.