mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Handle on_sp in syntax_suggest when using prism
It used to not emit this token type, but now it does. So when a newer version of prism is present, we can fall back to the same code that ripper uses.
This commit is contained in:
parent
300927b4bb
commit
20113a228d
Notes:
git
2026-01-20 13:19:03 +00:00
@ -180,10 +180,13 @@ module SyntaxSuggest
|
||||
# EOM
|
||||
# expect(lines.first.trailing_slash?).to eq(true)
|
||||
#
|
||||
if SyntaxSuggest.use_prism_parser?
|
||||
if SyntaxSuggest.use_prism_parser? && Prism::VERSION <= "1.8.0"
|
||||
# Older versions of prism didn't correctly emit on_sp
|
||||
def trailing_slash?
|
||||
last = @lex.last
|
||||
last&.type == :on_tstring_end
|
||||
return false unless last
|
||||
|
||||
last.type == :on_tstring_end || (last.type == :on_sp && last.token == TRAILING_SLASH)
|
||||
end
|
||||
else
|
||||
def trailing_slash?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user