Feature #18296
Updated by Eregon (Benoit Daloze) about 3 years ago
After discussing with @eregon, we came to the conclusion that the current implementation of `did_you_mean` and `error_highlighter` could avoid many issues by using `Exception#full_message`. We propose to introduce a more nuanced interface: ```ruby class Exception def full_message(highlight: bool, order: [:top or :bottom], **options) # ... end end module DidYouMean class Formatter def full_message(highlight:, did_you_mean: true, **options) buffer = super(highlight: highlight, **options).dup buffer << "extra stuff" end end end module ErrorHighlight ErrorHighlighter class Formatter def full_message(highlight:, error_highlight: error_highlighter: true, **options) # same as above end end end ``` Related issues: - https://bugs.ruby-lang.org/issues/18170 - https://bugs.ruby-lang.org/issues/18194