Is there a way to avoid creating temporary variables just to document block's argument YARD type?
The snippet below works but these temporary variables doesn't look good.
foos.each_with_object(Set.new) do |foo, obj|
# @type [Set]
set = obj
# now set/memo variable is semi-typed and LSP can do type-based autocompletion
end
Use
@paramlike so:I'm not sure if it is fully idiomatic YARD approach but it works in LSP/Solargraph.
Originally I found this example in the Solargraph spec.