Skip to content

Rows with different content causes table failure #60

Description

@rocketraman

I have a case in which I have rows with different content. For example, some rows use a dash for a value if it is not applicable, while other rows may have a numeric value.

It seems like ktformat uses an "example row" to decide what formatting to apply to every row, but this then results in an exception like this:

java.lang.IllegalArgumentException: Can not format value '—' of type 'class java.lang.String 'using format spec '%-8d'

This seems like a common use case that it would be nice to handle elegantly. Perhaps one way to do it is to provide value converters as hints. If such a hint was provided, it would be used to transform the value for display rather than the example row.

The workaround is to ensure all values added to a row are consistent i.e. numeric values are converted to Strings in advance, so that the example row has consistent types with every other row.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions