From e94604966572bb43fc887856d54aa54b8e9f7719 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 18 Jun 2021 17:11:39 +0900 Subject: [WIP] add error_squiggle gem ``` $ ./local/bin/ruby -e '1.time {}' -e:1:in `
': undefined method `time' for 1:Integer (NoMethodError) 1.time {} ^^^^^ Did you mean? times ``` https://bugs.ruby-lang.org/issues/17930 --- ruby.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index baa2f251c2..c8b3964c39 100644 --- a/ruby.c +++ b/ruby.c @@ -94,6 +94,8 @@ void rb_warning_category_update(unsigned int mask, unsigned int bits); #define EACH_FEATURES(X, SEP) \ X(gems) \ SEP \ + X(error_squiggle) \ + SEP \ X(did_you_mean) \ SEP \ X(rubyopt) \ @@ -320,6 +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("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)"), @@ -1508,6 +1511,9 @@ 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(did_you_mean)) { rb_define_module("DidYouMean"); } -- cgit v1.2.3