Strange inlining behavior of TomlTable when serializing #89
Labels
enhancement
New feature or request
PR welcome
User contribution/PR is welcome
question
Further information is requested
Hello, first and foremost thank you for creating this library!
Today I switched from json to toml for our application config format because json makes it really hard to deal with comments. For us the use-case is really important that we can roundtrip the config like this:
Config string => deserialized model => change model, e.g. change a property => serialize to config again and save
Your library brought us almost there, comments are handled very well and roundtripped to the serialized output. But I noticed some strange behavior regarding when TomTable is serialized as inline object (key value pairs with brackets) and when as a proper table syntax (like
[table]...
).Consider the following script (you can use roslynpad to test it)
note that the inlining behavior of the TomlTable Map somehow depends on if Array is there or if Map2 is there. For my specific use case the 2nd output is undesirable, but is the output I get.
My question:
Is this by design or a bug in the inlining behavior? It would be really nice to have an option for configuring the inlining behavior from the outside. And it would be super useful for a configuration language to remember the SyntaxKind that the Node (in this case TomlTable) was created from such that it can serialize to the same SyntaxKind when serialized.
If you agree that these features would be useful I would be down to implement them and send a PR.
The text was updated successfully, but these errors were encountered: