Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[C/C++] remove switch case auto unindent

Open Nemi26 opened this issue 1 year ago • 1 comments

Expected behavior

Don't unindent when you type case

Actual behavior

every time you type case, it auto unindents and you end up with each next case being less indented than the previous. No other editor that I'm aware of does this.

Steps to reproduce

https://github.com/sublimehq/Packages/assets/144807965/998001b1-aa99-4c74-aa6d-c57dd809a1cf

Nemi26 avatar Apr 21 '24 12:04 Nemi26

Indentation rules work on a per-line basis using regular expressions. Only a single style of indentation can be supported at a time.

The intended style is:

void main(int argc) {
	switch(argc) {
	case 1:
		// statements
		break;
	
	case 2:
		{
			// statements
		}
		break;

	default:
		// statements
		break
	}
}

The way of using brackets directly after case seems rather uncommon.

Anything else requires customization on users end.

It is not currently planned to change the defaults.

deathaxe avatar Apr 21 '24 12:04 deathaxe