From e8e1e1a3ce9c1f011e99044679797a4bddb25d14 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Thu, 1 Sep 2022 17:47:34 +0200 Subject: [PATCH] Strip 'file ' prefix from all filenames in RdocToYard --- lib/solargraph/yard_map/rdoc_to_yard.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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