From 2e9c186f26e8c3dc8ca91f64691d7da77df8d3df 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 | 10 +++++++--- 1 file changed, 7 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..f1d66027f 100644 --- a/lib/solargraph/yard_map/rdoc_to_yard.rb +++ b/lib/solargraph/yard_map/rdoc_to_yard.rb @@ -129,11 +129,15 @@ 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 + + return if file.nil? + + file.to_s.sub(/^file /, '') end end end