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

Formatting array elements to a maximum width #677

Open
xseman opened this issue Oct 17, 2024 · 1 comment
Open

Formatting array elements to a maximum width #677

xseman opened this issue Oct 17, 2024 · 1 comment

Comments

@xseman
Copy link

xseman commented Oct 17, 2024

I'm working with a large array of data and would prefer not to have it all on one line, nor formatted as one item per line. I've seen examples in C code where data like this is formatted to fit a maximum width and then breaks onto a new line, making it easier to read.

Is there a configuration setting that allows me to do this? I've searched for array formatting options but haven't found any related to this.

example with max width 80:

test("encode - create data with checksum", () => {
	const checksum = addChecksum(serializedPaymentOrder);
	/** dprint-ignore */
	const expected = Uint8Array.from([
		0x90, 0x94, 0x19, 0x21, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x2d, 0x69,
		0x64, 0x09, 0x31, 0x09, 0x31, 0x09, 0x31, 0x30, 0x30, 0x09, 0x45, 0x55,
		0x52, 0x09, 0x09, 0x31, 0x32, 0x33, 0x09, 0x09, 0x09, 0x09, 0x09, 0x31,
		0x09, 0x53, 0x4b, 0x39, 0x36, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
		0x30, 0x30, 0x30, 0x32, 0x39, 0x31, 0x38, 0x35, 0x39, 0x39, 0x36, 0x36,
		0x39, 0x09, 0x09, 0x30, 0x09, 0x30, 0x09, 0x09, 0x09
	]);
	assert.deepEqual(checksum, expected);
});
@xseman
Copy link
Author

xseman commented Oct 18, 2024

Sorry, I created the issue in the wrong repository. It should be in dprint-plugin-typescript

@dsherret dsherret transferred this issue from dprint/dprint Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant