[ruby/syntax_suggest] Add temp support for 3.2.0-preview{3,2,1}
This SyntaxError#path feature only exists in Ruby HEAD. Until it is released in a preview I want to continue to support existing releases of 3.2.0 (and also so CI will continue to work, as it still uses a preview version to execute tests). https://github.com/ruby/syntax_suggest/commit/9862032465
This commit is contained in:
parent
652e2d8f5d
commit
85a1c67a65
@ -25,7 +25,16 @@ if SyntaxError.method_defined?(:detailed_message)
|
||||
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
|
||||
|
||||
message = super
|
||||
file = path
|
||||
|
||||
file = if respond_to?(:path)
|
||||
path
|
||||
elsif highlight
|
||||
# This branch will be removed when the next Ruby 3.2 preview is released with
|
||||
# support for SyntaxError#path
|
||||
SyntaxSuggest::PathnameFromMessage.new(super(highlight: false, **kwargs)).call.name
|
||||
else
|
||||
SyntaxSuggest::PathnameFromMessage.new(message).call.name
|
||||
end
|
||||
|
||||
if file
|
||||
file = Pathname.new(file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user