Skip to content

Commit

Permalink
YardMap ignores absolute paths (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
castwide committed Nov 20, 2023
1 parent 32b00b3 commit 2ab41c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/solargraph/yard_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def process_gemsets
def pins_for_require r, already_errored
result = []
begin
name = r.split('/').first
name = r.split('/').first.to_s
return [] if name.empty? || @source_gems.include?(name) || @gem_paths.key?(name)
spec = spec_for_require(name)
@gem_paths[name] = spec.full_gem_path
Expand Down Expand Up @@ -282,7 +282,7 @@ def yardoc_file_for_spec spec
# @param path [String]
# @return [Gem::Specification]
def spec_for_require path
name = path.split('/').first
name = path.split('/').first.to_s
spec = Gem::Specification.find_by_name(name, @gemset[name])

# Avoid loading the spec again if it's going to be skipped anyway
Expand Down
10 changes: 10 additions & 0 deletions spec/yard_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,14 @@
expect(pin).to be
end
end

it 'ignores workspace requires starting with `/`' do
yard_map = Solargraph::YardMap.new
yard_map.change(['/'].to_set, "", [].to_set)
end

it 'ignores require references starting with `/`' do
yard_map = Solargraph::YardMap.new
yard_map.require_reference('/')
end
end

0 comments on commit 2ab41c1

Please sign in to comment.