-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take advantage of ICustomFormatter
or IFormattable
when an object with default destructuring
#23
base: master
Are you sure you want to change the base?
Conversation
ICustomFormatter
or IFormattable
ICustomFormatter
or IFormattable
when an object with default destructuring
Is this still true even with support custom format ? |
Hi @lust4life sorry I haven't got to this yet, I'll try to look in the next few days 👍 Thanks! |
@adamchester 😃 , ok , take your time. i will ping you after few days. |
@adamchester do we need consider replace type User =
{
id : int
name : string
created : DateTime
}
let foo = { id = 999; name = "foo"; created = DateTime.Now}
Formatting.format (Parser.parse "stringify is: {$foo} and destructure is: {@capture}") [| foo; foo |] right now: val it : string =
"stringify is: "{id = 999;
name = \"foo\";
created = 11/18/2017 2:37:46 PM;}" and destructure is: User { id: 999, name: "foo", created: 11/18/2017 2:37:46 PM }" replaced: val it : string =
"stringify is: "{id = 999;\n name = \"foo\";\n created = 11/18/2017 2:43:30 PM;}" and destructure is: User { id: 999, name: "foo", created: 11/18/2017 2:43:30 PM }" if user want to keep newline as it was, they can add Formatting.format (Parser.parse "stringify is: {$foo:l} and destructure is: {@capture}") [| foo; foo |]
val it : string =
"stringify is: {id = 999;
name = "foo";
created = 11/18/2017 2:37:46 PM;} and destructure is: User { id: 999, name: "foo", created: 11/18/2017 2:37:46 PM }" |
after that, things become as:
|
Hey @lust4life!
Can you please elaborate on why replacing newlines would be better? |
want to use messagetemplates to format But it's not necessary, it's just a temporary thought and can be done in logary itself. What i really want here is: change |
and should we support Map here isScalarDict ? |
Change
scalarStringCatchAllDestr
to catch the original scalar object, then format properly whenwritePropValue
.e.g.
before:
after: