Skip to content

Fix docs for csharp_indent_labels #273

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

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 37 additions & 14 deletions docs/ide/editorconfig-code-style-settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1012,45 +1012,68 @@ csharp_indent_switch_labels = true
### <a name="label">Label Positioning</a>
| **Option Name** | **Applicable Languages** | **Visual Studio Default** | **Supported Version** |
| ----------- | -------------------- | ----------------------| ---------------- |
|`csharp_indent_labels` | C# | one_less | Visual Studio 2017 v. 15.3 |
|`csharp_indent_labels` | C# | no_change | Visual Studio 2017 v. 15.3 |


| Value | Description
| ------------- |:-------------|
| one_less | Labels are placed at one less indent to the current context |
| flush_left | Labels are placed at the leftmost column |
| one_less_than_current | Labels are placed at one less indent to the current context |
| no_change | Labels are placed at the same indent as the current context |

#### Applied:

```csharp
// csharp_indent_labels = one_less
private string MyMethod(...)
// csharp_indent_labels= flush_left
class C
{
if (...) {
goto error;
}
private string MyMethod(...)
{
if (...) {
goto error;
}
error:
throw new Exception(...);
throw new Exception(...);
}
}
```

```csharp
// csharp_indent_labels = one_less_than_current
class C
{
private string MyMethod(...)
{
if (...) {
goto error;
}
error:
throw new Exception(...);
}
}

```

```csharp
// csharp_indent_labels= no_change
private string MyMethod(...)
class C
{
if (...) {
goto error;
private string MyMethod(...)
{
if (...) {
goto error;
}
error:
throw new Exception(...);
}
error:
throw new Exception(...);
}
```

#### Example editorconfig file:
```
# CSharp formatting settings:
[*.cs]
csharp_indent_labels = one_less
csharp_indent_labels = flush_left
```

## <a name="spacing">Spacing Options</a>
Expand Down