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

Don't reformat tabular data. #583

Open
belav opened this issue Jan 31, 2022 · 4 comments
Open

Don't reformat tabular data. #583

belav opened this issue Jan 31, 2022 · 4 comments

Comments

@belav
Copy link
Owner

belav commented Jan 31, 2022

There are cases where we want to keep the original formatting on arrays

        private static readonly char[] _Base64Code = {
            '.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
            'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
            'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
            'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
            'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5',
            '6', '7', '8', '9'
        };

Keeping this as is will be much more readable than putting every char on its own line.

@belav belav added area:formatting type:bug Something isn't working and removed type:bug Something isn't working labels Jan 31, 2022
@belav
Copy link
Owner Author

belav commented Jan 31, 2022

One concern, how do we decide that it is tabular? If each line has the same number of arguments? What happens if someone adds a new argument to the first line? Do they need to rearrange the whole line?

Other examples https://github.com/dlech/SshAgentLib/blob/07c4d17f6648d13378dee274ebc8efa3c9b78144/SshAgentLib/Crypto/BCrypt.cs#L355

google java format discussion
google/google-java-format#137 (comment)

@jods4
Copy link

jods4 commented May 19, 2022

This kind of situations is given as examples for // prettier-ignore.

It's hard to decide when a collection should be printed with a fixed number of items per line.
It's probably best to just let user indicate // csharpier-ignore if they're writing matrices, a sudoku solver or similar.

Aside: do you have a date planned for the next release?
I'd like to try csharpier and provide feedback based on large, complex projects but I'm waiting for the new configurable tabs to land in released version.

@belav
Copy link
Owner Author

belav commented May 20, 2022

Aside: do you have a date planned for the next release?

I can make sure it gets out this weekend. I've been releasing less often because I haven't had as much time to work on csharpier. But I think releasing more regularly even if there is less in each release makes more sense.

@SK-Genius
Copy link

WorkAroundExists :-)

        private static readonly char[] _Base64Code = {
            new []{ '.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J' },
            new []{ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V' },
            new []{ 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' },
            new []{ 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't' },
            new []{ 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5' },
            new []{ '6', '7', '8', '9' }
        }.SelectMany(_ => _).ToArray();

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

No branches or pull requests

3 participants