Skip to content

Add formatting fixes for chained functions and big arrays.#12

Merged
lmichaudel merged 2 commits into
lmichaudel:mainfrom
tonis2:main
Mar 27, 2026
Merged

Add formatting fixes for chained functions and big arrays.#12
lmichaudel merged 2 commits into
lmichaudel:mainfrom
tonis2:main

Conversation

@tonis2
Copy link
Copy Markdown
Contributor

@tonis2 tonis2 commented Mar 24, 2026

Improve the formatting of functions like these, they wont break on param's anymore.

	Pipeline pipeline = vk::graphicsPipelineCreateInfo()
	.setStages(
		shader_stages[..]
	)
	.setLayout(pipeline_layout)
	.setVertexInputState(&vertex_input_state)
	.setDynamicState(&dynamic_state)
	.setRasterizationState(&rasterization_state)
	.setInputAssemblyState(&input_assembly_state)
	.setMultisampleState(&multisample_state)
	.setDepthStencilState(&depth_stencil_state)
	.setColorBlendState(&color_blend_state)
	.setViewportState(&viewport_state)
	.setRenderPass(render_pass)
	.build(device)!!;

And long arrays, wont break on every item, and will respect the max-width.

@lmichaudel
Copy link
Copy Markdown
Owner

Thank you for this PR. I'm just unsure of the last commit, I liked the solution of @ManuLinares, that allowed to have an user defined formatting, which imo yield better results. On the one hand your solution enforces the same logic on every cases, but on the other hand I think it looks worse.

@tonis2
Copy link
Copy Markdown
Contributor Author

tonis2 commented Mar 25, 2026

@lmichaudel I removed the array formatter edit.
The reason I added it was this code part

Currently the formatter breaks the array, in some cases, so each item get's line-break.

@lmichaudel
Copy link
Copy Markdown
Owner

I suspect it's because it was previously formatted with an older version of c3fmt.
If you manually format it, c3fmt will let it unchanged, as intended.

e.g. :

ushort[] indices = {
	12, 13, 14, 12, 14, 15, // bottom
	16, 17, 18, 16, 18, 19, // right
	20, 21, 22, 20, 22, 23 // left
};

If you still want to tackle this, I suggest you open another PR, for the moment I'll merge this one.

@lmichaudel lmichaudel merged commit 8699624 into lmichaudel:main Mar 27, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants