diff --git a/lib/solargraph/yard_map/rdoc_to_yard.rb b/lib/solargraph/yard_map/rdoc_to_yard.rb index 767817c57..5e3a76717 100644 --- a/lib/solargraph/yard_map/rdoc_to_yard.rb +++ b/lib/solargraph/yard_map/rdoc_to_yard.rb @@ -129,11 +129,14 @@ def self.locate obj end def self.find_file obj - if obj.respond_to?(:in_files) && !obj.in_files.empty? - [obj.in_files.first.to_s.sub(/^file /, ''), obj.line] + file = if obj.respond_to?(:in_files) && !obj.in_files.empty? + obj.in_files.first else - [obj.file, obj.line] + obj.file end + + file = file.to_s.sub(/^file /, '') unless file.nil? + [file, obj.line] end end end