sp_before_sparen
Add or remove space before (
of control statements (if
, for
, switch
, while
etc.).
Possible values are ignore, add, remove and force. Default ignore.
Note, there are some special cases for this option: sp_catch_paren, sp_version_paren and sp_scope_paren.
Examples
add
Code before:
if(x<20) sum = 30;
for(int i=0; i<x; i++) {
sum = sum+i;
}
Code after:
if (x<20) sum = 30;
for (int i=0; i<x; i++) {
sum = sum+i;
}
remove
Code before:
if (x<20) sum = 30;
for (int i=0; i<x; i++) {
sum = sum+i;
}
Code after:
if(x<20) sum = 30;
for(int i=0; i<x; i++) {
sum = sum+i;
}
See also
- sp_catch_paren: Add or remove space between
catch
and(
incatch (something) { }
. - sp_catch_brace - Add or remove space before the
{
of acatch
statement, if the{
andcatch
are on the same line, as incatch (decl) <here> {
. - sp_version_paren (D) Add or remove space between 'version' and '(' in 'version (something) { }'. If set to ignore, sp_before_sparen is used.
- sp_scope_paren - (D) Add or remove space between 'scope' and '(' in 'scope (something) { }'. If set to ignore, sp_before_sparen is used.