From b8484cbd5ae566a29624cb3a832e44fb70005b41 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Thu, 8 Dec 2022 08:00:20 +0100 Subject: [PATCH] Strip 'file ' prefix from all filenames in RdocToYard (#585) --- 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