1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Rename error_squiggle to error_highlight

This commit is contained in:
Yusuke Endoh 2021-06-28 13:27:35 +09:00
parent e946049665
commit 9438c99590
Notes: git 2021-06-29 23:46:18 +09:00
8 changed files with 33 additions and 33 deletions

View file

@ -5,10 +5,10 @@ rescue LoadError
end if defined?(Gem)
begin
require 'error_squiggle'
require 'error_highlight'
rescue LoadError
warn "`error_squiggle' was not loaded."
end if defined?(ErrorSquiggle)
warn "`error_highlight' was not loaded."
end if defined?(ErrorHighlight)
begin
require 'did_you_mean'

2
lib/error_highlight.rb Normal file
View file

@ -0,0 +1,2 @@
require_relative "error_highlight/base"
require_relative "error_highlight/core_ext"

View file

@ -1,6 +1,6 @@
require_relative "version"
module ErrorSquiggle
module ErrorHighlight
# Identify the code fragment that seems associated with a given error
#
# Arguments:

View file

@ -1,4 +1,4 @@
module ErrorSquiggle
module ErrorHighlight
module CoreExt
SKIP_TO_S_FOR_SUPER_LOOKUP = true
private_constant :SKIP_TO_S_FOR_SUPER_LOOKUP
@ -22,7 +22,7 @@ module ErrorSquiggle
point = :args
end
spot = ErrorSquiggle.spot(node, point, **opts) do |lineno, last_lineno|
spot = ErrorHighlight.spot(node, point, **opts) do |lineno, last_lineno|
last_lineno ||= lineno
node.script_lines[lineno - 1 .. last_lineno - 1].join("")
end

View file

@ -1,3 +1,3 @@
module ErrorSquiggle
module ErrorHighlight
VERSION = "0.1.0"
end

View file

@ -1,2 +0,0 @@
require_relative "error_squiggle/base"
require_relative "error_squiggle/core_ext"

8
ruby.c
View file

@ -94,7 +94,7 @@ void rb_warning_category_update(unsigned int mask, unsigned int bits);
#define EACH_FEATURES(X, SEP) \
X(gems) \
SEP \
X(error_squiggle) \
X(error_highlight) \
SEP \
X(did_you_mean) \
SEP \
@ -322,7 +322,7 @@ usage(const char *name, int help, int highlight, int columns)
};
static const struct message features[] = {
M("gems", "", "rubygems (only for debugging, default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("error_squiggle", "", "error_squiggle (default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("error_highlight", "", "error_highlight (default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("did_you_mean", "", "did_you_mean (default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
M("frozen-string-literal", "", "freeze all string literals (default: disabled)"),
@ -1511,8 +1511,8 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
if (opt->features.set & FEATURE_BIT(gems)) {
rb_define_module("Gem");
if (opt->features.set & FEATURE_BIT(error_squiggle)) {
rb_define_module("ErrorSquiggle");
if (opt->features.set & FEATURE_BIT(error_highlight)) {
rb_define_module("ErrorHighlight");
}
if (opt->features.set & FEATURE_BIT(did_you_mean)) {
rb_define_module("DidYouMean");

View file

@ -1,8 +1,8 @@
require "test/unit"
require "error_squiggle"
require "error_highlight"
class ErrorSquiggleTest < Test::Unit::TestCase
class ErrorHighlightTest < Test::Unit::TestCase
class DummyFormatter
def message_for(corrections)
""
@ -613,7 +613,7 @@ undefined method `foo=' for #{ v.inspect }
def test_CONST
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::NotDefined
uninitialized constant ErrorHighlightTest::NotDefined
1 + NotDefined + 1
^^^^^^^^^^
@ -625,25 +625,25 @@ uninitialized constant ErrorSquiggleTest::NotDefined
def test_COLON2_1
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::NotDefined
uninitialized constant ErrorHighlightTest::NotDefined
ErrorSquiggleTest::NotDefined
ErrorHighlightTest::NotDefined
^^^^^^^^^^^^
END
ErrorSquiggleTest::NotDefined
ErrorHighlightTest::NotDefined
end
end
def test_COLON2_2
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::NotDefined
uninitialized constant ErrorHighlightTest::NotDefined
NotDefined
^^^^^^^^^^
END
ErrorSquiggleTest::
ErrorHighlightTest::
NotDefined
end
end
@ -666,7 +666,7 @@ uninitialized constant NotDefined
def test_OP_CDECL_read_1
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::OP_CDECL_TEST::NotDefined
uninitialized constant ErrorHighlightTest::OP_CDECL_TEST::NotDefined
OP_CDECL_TEST::NotDefined += 1
^^^^^^^^^^^^
@ -678,7 +678,7 @@ uninitialized constant ErrorSquiggleTest::OP_CDECL_TEST::NotDefined
def test_OP_CDECL_read_2
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::OP_CDECL_TEST::NotDefined
uninitialized constant ErrorHighlightTest::OP_CDECL_TEST::NotDefined
OP_CDECL_TEST::NotDefined += # comment
^^^^^^^^^^^^
@ -691,7 +691,7 @@ uninitialized constant ErrorSquiggleTest::OP_CDECL_TEST::NotDefined
def test_OP_CDECL_read_3
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::OP_CDECL_TEST::NotDefined
uninitialized constant ErrorHighlightTest::OP_CDECL_TEST::NotDefined
END
OP_CDECL_TEST::
@ -751,13 +751,13 @@ uninitialized constant NotDefined
def test_OP_CDECL_toplevel_2
assert_error_message(NoMethodError, <<~END) do
undefined method `+' for ErrorSquiggleTest:Class
undefined method `+' for ErrorHighlightTest:Class
::ErrorSquiggleTest += 1
::ErrorHighlightTest += 1
^
END
::ErrorSquiggleTest += 1
::ErrorHighlightTest += 1
end
end
@ -787,13 +787,13 @@ NoMethodError
def test_const_get
assert_error_message(NameError, <<~END) do
uninitialized constant ErrorSquiggleTest::NotDefined
uninitialized constant ErrorHighlightTest::NotDefined
ErrorSquiggleTest.const_get(:NotDefined)
ErrorHighlightTest.const_get(:NotDefined)
^^^^^^^^^^
END
ErrorSquiggleTest.const_get(:NotDefined)
ErrorHighlightTest.const_get(:NotDefined)
end
end