Skip to content

Commit 55574b1

Browse files
authored
Merge pull request #273 from giggio/patch-2
Fix docs for csharp_indent_labels
2 parents bce0a23 + 919e9d5 commit 55574b1

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

docs/ide/editorconfig-code-style-settings-reference.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,45 +1012,68 @@ csharp_indent_switch_labels = true
10121012
### <a name="label">Label Positioning</a>
10131013
| **Option Name** | **Applicable Languages** | **Visual Studio Default** | **Supported Version** |
10141014
| ----------- | -------------------- | ----------------------| ---------------- |
1015-
|`csharp_indent_labels` | C# | one_less | Visual Studio 2017 v. 15.3 |
1015+
|`csharp_indent_labels` | C# | no_change | Visual Studio 2017 v. 15.3 |
10161016

10171017

10181018
| Value | Description
10191019
| ------------- |:-------------|
1020-
| one_less | Labels are placed at one less indent to the current context |
1020+
| flush_left | Labels are placed at the leftmost column |
1021+
| one_less_than_current | Labels are placed at one less indent to the current context |
10211022
| no_change | Labels are placed at the same indent as the current context |
10221023

10231024
#### Applied:
1025+
10241026
```csharp
1025-
// csharp_indent_labels = one_less
1026-
private string MyMethod(...)
1027+
// csharp_indent_labels= flush_left
1028+
class C
10271029
{
1028-
if (...) {
1029-
goto error;
1030-
}
1030+
private string MyMethod(...)
1031+
{
1032+
if (...) {
1033+
goto error;
1034+
}
10311035
error:
1032-
throw new Exception(...);
1036+
throw new Exception(...);
1037+
}
1038+
}
1039+
```
1040+
1041+
```csharp
1042+
// csharp_indent_labels = one_less_than_current
1043+
class C
1044+
{
1045+
private string MyMethod(...)
1046+
{
1047+
if (...) {
1048+
goto error;
1049+
}
1050+
error:
1051+
throw new Exception(...);
1052+
}
10331053
}
10341054

10351055
```
10361056

10371057
```csharp
10381058
// csharp_indent_labels= no_change
1039-
private string MyMethod(...)
1059+
class C
10401060
{
1041-
if (...) {
1042-
goto error;
1061+
private string MyMethod(...)
1062+
{
1063+
if (...) {
1064+
goto error;
1065+
}
1066+
error:
1067+
throw new Exception(...);
10431068
}
1044-
error:
1045-
throw new Exception(...);
10461069
}
10471070
```
10481071

10491072
#### Example editorconfig file:
10501073
```
10511074
# CSharp formatting settings:
10521075
[*.cs]
1053-
csharp_indent_labels = one_less
1076+
csharp_indent_labels = flush_left
10541077
```
10551078

10561079
## <a name="spacing">Spacing Options</a>

0 commit comments

Comments
 (0)