Skip to content

Commit

Permalink
Redo this - *only* read the sorbet directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner committed Jul 19, 2023
1 parent 37c84eb commit 3ebd863
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/sord/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ def self.load_gem_objects(hash)
end
add_rbs_objects_to_paths(env, hash)

gem_paths = Bundler.load.specs.map(&:full_gem_path)
gem_paths.each do |path|
next unless File.exist?("#{path}/rbi")

Dir["#{path}/rbi/**/*.rbi"].each do |sigfile|
tree = Parlour::TypeLoader.load_file(sigfile)
add_rbi_objects_to_paths(tree.children, hash)
end
Dir["#{Dir.pwd}/sorbet/rbi/**/*.rbi"].each do |sigfile|
tree = Parlour::TypeLoader.load_file(sigfile)
add_rbi_objects_to_paths(tree.children, hash)
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,8 @@ class B
expect(subject.path_for('B')).to be nil # Ambiguous
end

it 'resolves included gem rbi files' do
subject.prepare
expect(subject.path_for('Parlour::RbiGenerator')).to eq 'Parlour::RbiGenerator'
end
end

0 comments on commit 3ebd863

Please sign in to comment.