Closed mrdziuban closed 5 years ago
https://github.com/tek/splain#truncating-module-paths
please see if this is satisfying to you!
Aha, I should have scrolled down further 🤦♂️ thank you!
oh no, I just built this!
should be on maven is a few minutes/hours.
Oh, I see! Well then thank you again -- I'll give it a shot!
@tek just following up, this works great. I ended up using this flag:
-P:splain:rewrite:^(([^\\.]+\\.)*)([^\\.]+)\\.Type$/$3
to rewrite anything like foo.bar.Baz.Type
into just Baz
. Thanks for the quick fix and all your work on splain!
it's my pleasure. thanks for the feedback! glad to here it's working out for you
Would it be possible to add configuration for how much to shorten types in errors? Maybe just an int to denote the minimum number of package/path parts to keep, defaulting to 1? e.g. for a type
foo.bar.baz.Thing
, setting the value to 2 would printbaz.Thing
instead of justThing
.This would make it a lot easier to use splain along with newtypes, which generate code like this:
so any errors for the
WidgetId
type printed by splain always end up just sayingType
.