Yusuke Endoh
94d6d6d93f
[ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameError
...
In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is
compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187
We try to spot which sub-node caues a NameError in question based on the
constant name. We will give up if the same constant name is accessed in
a nested access (`Foo::Foo`).
Fixes https://github.com/ruby/error_highlight/pull/31
https://github.com/ruby/error_highlight/commit/0a4db7da0a
2023-01-13 08:25:09 +00:00
Yusuke Endoh
d019c3a4bd
[ruby/error_highlight] Bump version
...
https://github.com/ruby/error_highlight/commit/5275078dc6
2022-11-14 06:37:33 +00:00
Yusuke Endoh
8bfd4dd4e1
[ruby/error_highlight] Enable ErrorHighlight for TypeError/ArgumentError only after Ruby 3.2
...
... because changing TypeError#message and ArgumentError#message is
highly incompatible.
https://github.com/ruby/error_highlight/commit/39aa897c7a
2022-11-14 06:06:12 +00:00
Yusuke Endoh
4e728486b9
[ruby/error_highlight] Bump version
...
https://github.com/ruby/error_highlight/commit/59c291cce1
2022-11-08 08:07:39 +00:00
eileencodes
350d0aa023
[ruby/error_highlight] Support nodes in `spot`
...
Fixes a bug where `spot` was using the wrong local variable.
We want to use error highlight with code that has been eval'd,
specifically ERB templates. We can recover the compiled source code of
the ERB template but we need an API to pass the node into error
highlight's `spot`.
Required Ruby PR: https://github.com/ruby/ruby/pull/6593
https://github.com/ruby/error_highlight/commit/0b1b650a59
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2022-10-31 04:58:38 +00:00
Yusuke Endoh
6bcb473d9c
[ruby/error_highlight] Apply ErrorHighlight::CoreExt to TypeError and ArgumentError
...
https://github.com/ruby/error_highlight/commit/defcaf1beb
2022-08-19 18:34:15 +09:00
Yusuke Endoh
d9f1b8baa3
[ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot
...
https://github.com/ruby/error_highlight/commit/489ce80a62
2022-08-12 14:04:41 +09:00
Yusuke Endoh
1b32a4c7bb
[ruby/error_highlight] Bump version
...
https://github.com/ruby/error_highlight/commit/6edf0a0a5d
2022-08-10 21:51:51 +09:00
Yusuke Endoh
3a58009066
[ruby/error_highlight] Make backtrace_location keyword work
...
We had to keep backtrace_location before opts is overwritten.
https://github.com/ruby/error_highlight/commit/2735e4681a
2022-08-10 21:19:10 +09:00
Yusuke Endoh
99e7fa5b37
[ruby/error_highlight] Make ErrorHighlight.spot accept Exception ( https://github.com/ruby/error_highlight/pull/25 )
...
... and move things from core_ext.rb to base.rb.
This will confine CRuby-dependent things to ErrorHighlight.spot.
https://github.com/ruby/error_highlight/commit/22d1dd7824
2022-08-10 18:37:13 +09:00
Yusuke Endoh
f075be3dcb
[ruby/error_highlight] Use Exception#detailed_message instead of overriding #message ( https://github.com/ruby/error_highlight/pull/24 )
...
See https://bugs.ruby-lang.org/issues/18564 .
Ref: https://github.com/ruby/did_you_mean/pull/177
https://github.com/ruby/error_highlight/commit/671b7c61b2
2022-06-07 17:40:19 +09:00
Christian Boos
11b1ebe606
[ruby/error_highlight] Fix the spurious TypeError.
...
When we have no backtrace locations, we can't have the highlight,
so just return the message.
https://github.com/ruby/error_highlight/commit/9f5c639494
2022-01-04 23:09:01 +09:00
Yusuke Endoh
d5019949b5
[ruby/error_highlight] Bump version
...
https://github.com/ruby/error_highlight/commit/ae3053686f
2021-12-23 12:56:07 +09:00
Yusuke Endoh
52b1c76534
Manually sync d2140d795a
2021-12-19 04:13:14 +09:00
Yusuke Endoh
acac2b8128
Make RubyVM::AbstractSyntaxTree.of raise for backtrace location in eval
...
This check is needed to fix a bug of error_highlight when NameError
occurred in eval'ed code.
https://github.com/ruby/error_highlight/pull/16
The same check for proc/method has been already introduced since
64ac984129
.
2021-12-19 03:51:37 +09:00
Yusuke Endoh
dc46529b64
[ruby/error_highlight] Ignore all syscall errors
...
At least, Error::ENOTSUP may be raised on some extreme environments
https://github.com/ruby/error_highlight/commit/2787983ff7
2021-11-30 13:49:04 +09:00
Yusuke Endoh
4c32fcb84f
[ruby/error_highlight] Make the formatter mechanism support Ractor
...
Now the formatter configuration is per Ractor. DefaultFormatter is used
if not set.
DefaultFormatter#message_for is now a class method to allow sub-Ractors
to call the method.
https://github.com/ruby/error_highlight/commit/9fbaa8ab7c
2021-10-27 11:29:20 +09:00
Yusuke Endoh
cad83fa3c4
ast.c: Rename "save_script_lines" to "keep_script_lines"
...
... as per ko1's preference. He is preparing to extend this feature to
ISeq for his new debugger. He prefers "keep" to "save" for this wording.
This API is internal and not included in any released version, so I
change it in advance.
2021-08-20 16:18:36 +09:00
Masataka Pocke Kuwabara
242f024bcb
[ruby/error_highlight] Keep it work if paren exists after receiver
...
https://github.com/ruby/error_highlight/commit/b79d679bbd
2021-07-31 22:15:16 +09:00
Yusuke Endoh
5fd5d71a4b
[ruby/error_highlight] Support a file that has no final newline
...
https://github.com/ruby/error_highlight/commit/9d671284cb
2021-07-13 16:54:17 +09:00
Yusuke Endoh
23c8bc367c
[ruby/error_highlight] Support hard tabs
...
Now, the highlight line is created by replacing non-tab characters with
spaces, and keeping all hard tabs as-is. This means the highlight line
has the completely same indentation as the code snippet line.
Fixes #7
https://github.com/ruby/error_highlight/commit/38f20fa542
2021-07-13 16:51:02 +09:00
Yusuke Endoh
8b01d16ad6
[ruby/error_highlight] Stop showing a code snippet if it has non-ascii characters
...
See https://github.com/ruby/error_highlight/issues/4
https://github.com/ruby/error_highlight/commit/c20efd3961
2021-07-12 16:48:15 +09:00
Yusuke Endoh
3a95834739
[ruby/error_highlight] Suppress SyntaxError during RubyVM::AST.of
...
When the original source code is erb, RubyVM::AST.of does not work well.
https://github.com/rails/rails/issues/42678 .
https://github.com/ruby/error_highlight/commit/b1572761a6
2021-07-02 16:48:20 +09:00
Yusuke Endoh
b6c910e1f4
[ruby/error_highlight] Allow the development version (= master branch) of Ruby 3.1
...
https://github.com/ruby/error_highlight/commit/2dca1446c9
2021-06-30 17:33:57 +09:00
Yusuke Endoh
8ccc257434
Add the gemspec for error_highlight
2021-06-30 14:02:28 +09:00
Yusuke Endoh
6c6b128c67
[ruby/error_highlight] Bump version
...
https://github.com/ruby/error_highlight/commit/8d483c251e
2021-06-30 13:36:31 +09:00
Yusuke Endoh
ca4e5b1eb3
[ruby/error_highlight] Reconsider the API of ErrorHighlight.spot
...
https://github.com/ruby/error_highlight/commit/acb2046a82
2021-06-30 12:49:27 +09:00
Yusuke Endoh
f428ced69c
[ruby/error_highlight] Experimentally support a custom formatter
...
https://github.com/ruby/error_highlight/commit/f40a1de20e
2021-06-30 12:49:18 +09:00
Yusuke Endoh
db7e9b1aac
[ruby/error_highlight] Add some comments
...
https://github.com/ruby/error_highlight/commit/e0c90c72c3
2021-06-30 11:46:47 +09:00
Yusuke Endoh
9438c99590
Rename error_squiggle to error_highlight
2021-06-29 23:45:49 +09:00