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

Keep scope braces next to loop braces with static foreach #607

Open
0xEAB opened this issue Feb 23, 2025 · 1 comment
Open

Keep scope braces next to loop braces with static foreach #607

0xEAB opened this issue Feb 23, 2025 · 1 comment

Comments

@0xEAB
Copy link

0xEAB commented Feb 23, 2025

static foreach does not introduce a new scope on its own; instead one has to add a nested set of braces.
Currently, dfmt splits them which wastes a good amount of screen space and might look a bit odd.

Current format

static foreach (item; items)
{
	{
		// code here
	}
}
static foreach (item; items) {
	{
		// code here
	}
}

Idea

I’d prefer to have the scope braces right next to the loop braces.

static foreach (item; items)
{{
	// code here
}}
static foreach (item; items) {{
	// code here
}}
@WebFreak001
Copy link
Member

great idea, it is pretty much the standard syntax for static foreach loops that do more than the basics

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

2 participants