Skip to content

Commit cbb2cfb

Browse files
authored
Merge pull request #43 from ruby/follow_rbs_collection_yaml
Don't load gem's rbs if rbs_collection.yaml exists
2 parents 237ebf2 + 358b89b commit cbb2cfb

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

lib/repl_type_completor/types.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ def self.load_rbs_builder
2929
sig_path = Pathname('sig')
3030
loader.add path: sig_path
3131
expanded_sig_path = sig_path.expand_path.to_s
32-
Gem.loaded_specs.values.each do |spec|
33-
gem_sig_path = File.expand_path("#{spec.gem_dir}/sig")
34-
loader.add(library: spec.name, version: spec.version) if Dir.exist?(gem_sig_path) && expanded_sig_path != gem_sig_path
32+
33+
unless File.exist?('rbs_collection.yaml')
34+
# Load rbs signature from gems. This is a fallback when rbs_collection.yaml is not available.
35+
Gem.loaded_specs.values.each do |spec|
36+
gem_sig_path = File.expand_path("#{spec.gem_dir}/sig")
37+
loader.add(library: spec.name, version: spec.version) if Dir.exist?(gem_sig_path) && expanded_sig_path != gem_sig_path
38+
end
3539
end
40+
3641
env = RBS::Environment.from_loader(loader)
3742
# [Hack] Monkey patch for improving development experience
3843
def env.resolve_declaration(*, **)

0 commit comments

Comments
 (0)