Skip to content

Commit f0a9dc7

Browse files
rkeithhilldaviwil
authored andcommitted
Add Stroustrup formatting style.
1 parent 5db4d79 commit f0a9dc7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs

+16-5
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,30 @@ public void Update(
9696
}
9797

9898
/// <summary>
99-
/// code formatting presets
99+
/// Code formatting presets.
100+
/// See https://en.wikipedia.org/wiki/Indent_style for details on indent and brace styles.
100101
/// </summary>
101102
public enum CodeFormattingPreset
102103
{
103-
104104
/// <summary>
105105
/// Use the formatting settings as-is.
106106
/// </summary>
107107
Custom,
108108

109109
/// <summary>
110-
/// Configure the formatting settings to resemble the one true brace style variant of KR indent/brace style.
110+
/// Configure the formatting settings to resemble the Allman indent/brace style.
111+
/// </summary>
112+
Allman,
113+
114+
/// <summary>
115+
/// Configure the formatting settings to resemble the one true brace style variant of K&R indent/brace style.
111116
/// </summary>
112117
OTBS,
113118

114119
/// <summary>
115-
/// Configure the formatting settings to resemble the Allman indent/brace style.
120+
/// Configure the formatting settings to resemble the Stroustrup brace style variant of K&R indent/brace style.
116121
/// </summary>
117-
Allman
122+
Stroustrup
118123
}
119124

120125
public class CodeFormattingSettings
@@ -184,6 +189,12 @@ public Hashtable GetPSSASettingsHashtable(
184189
closeBraceSettings["NewLineAfter"] = false;
185190
break;
186191

192+
case CodeFormattingPreset.Stroustrup:
193+
openBraceSettings["OnSameLine"] = true;
194+
openBraceSettings["NewLineAfter"] = true;
195+
closeBraceSettings["NewLineAfter"] = true;
196+
break;
197+
187198
default:
188199
break;
189200
}

0 commit comments

Comments
 (0)