mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[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).
9862032465
This commit is contained in:
parent
652e2d8f5d
commit
85a1c67a65
1 changed files with 10 additions and 1 deletions
|
@ -25,7 +25,16 @@ if SyntaxError.method_defined?(:detailed_message)
|
||||||
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
|
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
|
||||||
|
|
||||||
message = super
|
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
|
if file
|
||||||
file = Pathname.new(file)
|
file = Pathname.new(file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue