[ruby/syntax_suggest] No longer need PathnameFromMessage with SyntaxError#path.

https://bugs.ruby-lang.org/issues/19138

  Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

https://github.com/ruby/syntax_suggest/commit/8e1e7b3298
This commit is contained in:
Hiroshi SHIBATA 2022-12-01 19:45:09 +09:00
Родитель def258e775
Коммит 652e2d8f5d
1 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -25,15 +25,12 @@ if SyntaxError.method_defined?(:detailed_message)
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
message = super
file = if highlight
SyntaxSuggest::PathnameFromMessage.new(super(highlight: false, **kwargs)).call.name
else
SyntaxSuggest::PathnameFromMessage.new(message).call.name
end
io = SyntaxSuggest::MiniStringIO.new
file = path
if file
file = Pathname.new(file)
io = SyntaxSuggest::MiniStringIO.new
SyntaxSuggest.call(
io: io,
source: file.read,