Skip to content
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

Controlling inline generation #45

Open
stephendrew opened this issue Oct 24, 2024 · 4 comments
Open

Controlling inline generation #45

stephendrew opened this issue Oct 24, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@stephendrew
Copy link

    public bool CanBeSerializedInline
    {
      get
      {
        if (!this.IsTableArray)
          return true;
        return this.ArrayValues.All<TomlValue>((Func<TomlValue, bool>) (o => o is TomlTable tomlTable && tomlTable.ShouldBeSerializedInline)) && this.ArrayValues.Count <= 5;
      }
    }

It would be great if somehow we could control this "5" value...

@SamboyCoding
Copy link
Owner

Do you want to increase or decrease it? If you want to decrease it, an alternative is simply to mark one of the tables as force no-inline, which will result in full table-array serialization. But if you want to increase it, that's fair, as these would be serialized with newlines after the commas, so the length is fairly arbitrary.

@SamboyCoding SamboyCoding added the enhancement New feature or request label Oct 24, 2024
@stephendrew
Copy link
Author

Really was just looking for a way for it to be consistent, but I'm serializing directly from C# objects.

@SamboyCoding
Copy link
Owner

You can do that, you can use [TomlDoNotInlineObject] on the class that's in the list

@stephendrew
Copy link
Author

stephendrew commented Oct 25, 2024

Ah fantastic, I must have missed that sorry. Maybe an always inline could be useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants