Skip to content

Commit

Permalink
Always use reference YARD tags when resolving param types (#515) (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeSeal authored Dec 14, 2021
1 parent 949fa3c commit 05525af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions lib/solargraph/pin/parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ def typify_method_param api_map
# meths.shift # Ignore the first one
meths.each do |meth|
found = nil
params = meth.docstring.tags(:param)
if params.empty?
params = see_reference(docstring, api_map)
end
params = meth.docstring.tags(:param) + see_reference(docstring, api_map)
params.each do |p|
next unless p.name == name
found = p
Expand Down
5 changes: 3 additions & 2 deletions spec/pin/parameter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,16 @@ class Foo
# @param bla [String]
def bar(bla)
end
# @param qux [Integer]
# @param (see Foo#bar)
def baz(bla)
def baz(qux, bla)
bla._
end
end
), 'test.rb')
api_map = Solargraph::ApiMap.new
api_map.map source
clip = api_map.clip_at('test.rb', [7, 14])
clip = api_map.clip_at('test.rb', [8, 14])
paths = clip.complete.pins.map(&:path)
expect(paths).to include('String#upcase')
end
Expand Down

0 comments on commit 05525af

Please sign in to comment.