[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108859] [Ruby master Feature#18159] Integrate functionality of dead_end gem into Ruby
From:
"nobu (Nobuyoshi Nakada)" <noreply@...>
Date:
2022-06-12 02:06:34 UTC
List:
ruby-core #108859
Issue #18159 has been updated by nobu (Nobuyoshi Nakada).
schneems (Richard Schneeman) wrote in #note-19:
> One idea: In addition to the `SyntaxError#path`, is it possible to also attach the source code the parser was just looking at maybe an API like `SyntaxError#source_contents`?
`AbstractSyntaxTree` already has `script_lines` for the sake of `AST.of` method.
I think it's reasonable to make these lines accessible from `SyntaxError` too.
My draft still fails since I've not updated the tests using `SyntaxError` yet.
```shell-session
$ ./ruby -r ../../dead_end/monkeypatch.rb ../../dead_end/bad.rb
../../dead_end/bad.rb:1: syntax error, unexpected end-of-input
def foo
^
Monkeypatch worked
[["../../dead_end/bad.rb:1: syntax error, unexpected end-of-input", 1, 7, 7, "def foo\n"]]
["def foo\n"]
```
This monkeypatch.rb is:
```ruby
SyntaxError.prepend Module.new {
def detailed_message(highlight: nil, **)
message = super
message += "Monkeypatch worked\n"
message << errors.inspect << "\n"
message << script_lines.inspect << "\n"
message
end
}
```
----------------------------------------
Feature #18159: Integrate functionality of dead_end gem into Ruby
https://bugs.ruby-lang.org/issues/18159#change-97939
* Author: duerst (Martin D端rst)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.1
----------------------------------------
Missing 'end' errors are difficult to fix. We should integrate the functionality of the dead_end gem (https://github.com/zombocom/dead_end) into Ruby similar to how we integrated did_you_mean. It would greatly help programming Ruby, in particular for beginners.
See also Ruby Kaigi Takeout 2021 talk by Richard Schneeman https://rubykaigi.org/2021-takeout/presentations/schneems.html.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>