From: "hsbt (Hiroshi SHIBATA)" Date: 2022-09-27T03:49:19+00:00 Subject: [ruby-core:110099] [Ruby master Bug#19016] syntax_suggest is not working with Ruby 3.2.0-preview2 Issue #19016 has been updated by hsbt (Hiroshi SHIBATA). I investigated this. https://github.com/ruby/syntax_suggest/blob/main/lib/syntax_suggest/api.rb#L67 ``` Timeout.timeout(timeout) do record_dir ||= ENV["DEBUG"] ? "tmp" : nil search = CodeSearch.new(source, record_dir: record_dir).call end ``` This block raises `#` with Ruby 3.2.0-preview2 and master branch. When I commented-out this `Timeout.timeout`, syntax_suggest is working fine. I bisected `timeout.rb`. After https://github.com/ruby/ruby/commit/89fbec224d8e1fa35e82bf2712c5a5fd3dc06b83 happens this `ThreadError` with syntax_suggest. I'm not sure why timeout.rb raises `ThreadError` when using syntax_suggest. ---------------------------------------- Bug #19016: syntax_suggest is not working with Ruby 3.2.0-preview2 https://bugs.ruby-lang.org/issues/19016#change-99357 * Author: hsbt (Hiroshi SHIBATA) * Status: Assigned * Priority: Normal * Assignee: hsbt (Hiroshi SHIBATA) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- `syntax_suggest` is merged as default gems in Ruby 3.2.0-preview2. But it's not working yet. ``` $ cat bar.rb def foo def bar end $ ruby -v bar.rb ruby 3.2.0dev (2022-09-22T05:37:56Z master f07e651a90) +YJIT [arm64-darwin22] bar.rb:3: warning: mismatched indentations at 'end' with 'def' at 2 bar.rb:3: syntax error, unexpected end-of-input, expecting `end' ``` and gem version is also not working now. ``` $ cat foo.rb require "bundler/inline" gemfile do source "https://rubygems.org" gem "syntax_suggest" end require_relative "bar" ``` ``` $ ruby -v foo.rb ruby 3.2.0dev (2022-09-22T05:37:56Z master f07e651a90) +YJIT [arm64-darwin22] /path/to/bar.rb:3: warning: mismatched indentations at 'end' with 'def' at 2 foo.rb:8:in `require_relative': /path/to/bar.rb:3: syntax error, unexpected end-of-input, expecting `end' (SyntaxError) from foo.rb:8:in `
' ``` But Ruby 3.1 is works. ``` $ ruby -v foo.rb ruby 3.1.3p51 (2022-09-10 revision 9581248c4a) [arm64-darwin22] /path/to/bar.rb:3: warning: mismatched indentations at 'end' with 'def' at 2 --> /path/to/bar.rb Unmatched keyword, missing `end' ? 1 def foo ��� 2 def bar 3 end /Users/hsbt/.local/share/gem/gems/syntax_suggest-0.0.1/lib/syntax_suggest/core_ext.rb:93:in `require': /path/to/bar.rb:3: syntax error, unexpected end-of-input, expecting `end' (SyntaxError) from /Users/hsbt/.local/share/gem/gems/syntax_suggest-0.0.1/lib/syntax_suggest/core_ext.rb:93:in `require_relative' from foo.rb:8:in `
' ``` -- https://bugs.ruby-lang.org/ Unsubscribe: