You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what the true intended "way to use" AddComment is
But doing something like
var table = new TableSyntax("test");
doc.Tables.Add(table);
table.AddComment("banana");
and later
var val = new StringValueSyntax("b value");
var item = new KeyValueSyntax("floopy a", "a value");
item.AddComment("something");
results in
#banana[test]
"floopy a" = # something"b value"
From what I can tell it's because trailing trivias are attached to items separately than the rest of the syntax and in the recursive loop its iterating, it'll hit the print of trivias before it finishes stacking children and printing them.
The text was updated successfully, but these errors were encountered:
@xoofx Thanks for the fix.
It works now for table items just fine.
One case though that doesn't quite work the way I expect it. I would like to add a comment next to the table header
[apples] # A red fruit
But if you add a trailing comment on the tablesyntax, it gets appended after all the key/value table items. If you add a trailing comment on the KeySyntax passed to TableSyntax, the comment gets inserted inside the brackets
That's intended, as the XXXSyntax has to respect anything you could write in a TOML to document (so you can place trivias all around).
You need to add it after table.CloseBracket.AddTrailingWhitespace().AddTrailingComment("your comment"), you can write your own extension method (e.g AddTableHeaderComment).
I'm not sure what the true intended "way to use" AddComment is
But doing something like
and later
results in
From what I can tell it's because trailing trivias are attached to items separately than the rest of the syntax and in the recursive loop its iterating, it'll hit the print of trivias before it finishes stacking children and printing them.
The text was updated successfully, but these errors were encountered: